Configure Basic Settings for a fresh OmniOS VMware Guest

Here is a quick and dirty shell script to configure a single interface OmniOS Guest:

root@ns1:~# cat addr.sh
#!/bin/bash
read -p “hostname:” hn
hostname $hn
echo $hn > /etc/nodename
echo “domain csuohio.edu” > /etc/resolv.conf
read -p “dns servers up to 3 separated by commas:” dns
echo $dns | awk -F’,’ ‘{print “nameserver ” $1}’ >> /etc/resolv.conf
echo $dns | awk -F’,’ ‘{print “nameserver ” $2}’ >> /etc/resolv.conf
echo $dns | awk -F’,’ ‘{print “nameserver ” $3}’ >> /etc/resolv.conf

e=`dladm show-link -p -o link`
if [ $e ]; then
ipadm create-if $e
adr=`ipadm show-addr -p -o addrobj | grep $e`
if [ $adr ]; then
ipadm delete-addr $adr
fi
read -p “IP address:” ipadr
read -p “subnet bits:” bits
ipadm create-addr -T static -a $ipadr/$bits $e/v4static
ipadm show-addr
gtwy=`netstat -rn | awk ‘$1==”default” {print $2}’`
route -p delete default $gtwy
read -p “gateway:” gtwy
route -p add default $gtwy
echo $ipadr”\t”$hn >>/etc/hosts
fi
root@ns1:~#

Permanent link to this article: https://daherlabs.mywire.org/wordpress/?p=121

1 comment

  1. Great article! This is the kind of information that are
    meant to be shared across the web. Shame on Google for
    now not positioning this submit upper! Come on over and visit
    my website . Thank you =)

Leave a Reply

Your email address will not be published.