OmniOS General Networking Commands

General OmniOS networking commands taken from the OmniOS site.

Setting up dynamic (DHCP) networking #

First identify the physical interface on which you would like networking:

# dladm show-phys

LINK MEDIA STATE SPEED DUPLEX DEVICE
e1000g0 Ethernet unknown 0 half e1000g0
e1000g1 Ethernet ? 1000 full e1000g1

Physical interfaces that don’t have a corresponding IP interface might not show their state correctly (in this case e1000g0).

To create an IP interface, then create an address and set it to DHCP:

# ipadm create-if e1000g0

# ipadm create-addr -T dhcp e1000g0/v4

# ipadm show-addr

ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
e1000g0/v4 dhcp ok 10.0.2.15/24
lo0/v6 static ok ::1/128

Setting up static networking #

Just as above, we need to create an interface (if it hasn’t been created already)

# ipadm create-if e1000g0

# ipadm create-addr -T static -a 192.168.1.10/24 e1000g0/v4static

# ipadm show-addr

ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
e1000g0/v4static static ok 192.168.1.10/24
lo0/v6 static ok ::1/128

Now to setup a default route of 192.168.1.1:

# route -p add default 192.168.1.1

# netstat -rn -finet

Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
——————– ——————– —– —– ———- ———
default 192.168.1.1 UG 1 0 e1000g0
192.168.1.0 192.168.1.10 U 3 349 e1000g0
127.0.0.1 127.0.0.1 UH 2 164 lo0

Finally, set up DNS resolution. Put your nameserver into /etc/resolv.conf and configure NSS to read DNS from that file.

# echo ‘nameserver 192.168.1.1’ >> /etc/resolv.conf

# cp /etc/nsswitch.conf{,.bak}

# cp /etc/nsswitch.{dns,conf}

Creating Additional Addresses #

There’s nothing special about the “v4” or “v4static” address names; it’s just a convention. You can create additional interfaces with whatever names you want.

# ipadm create-addr -T static -a 192.168.1.11/24 e1000g0/myfancyaddr

If you want to set up a temporary IP address (that won’t be restored after boot), use -t instead of -T:

# ipadm create-addr -t static -a 192.168.1.11/24 e1000g0/myfancyonetimeaddr

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

Leave a Reply

Your email address will not be published.