Solaris interfaces – create assign delete


Working with interfaces in Solaris is pretty much the same as in Linux - you've got ifconfig, netstat,route. It looks in output a bit different but if you're used to the *BSD way of things you'll find yourself at home. So the most basic thing follows - bring interface up, assign ipv4 address, save the change to survive reboot.
Plumb. First step sounds a bit strange - plumbing, but is actually very simple (no need to call for Mario) . You just plumb the interface (I talk about Ethernet-type interfaces) to the IP stack. - Interface before plumbing :

bash-3.00# ifconfig e1000g2

ifconfig: status: SIOCGLIFFLAGS: e1000g2: no such interface

Even an unplumbed interface can be seen with:

bash-3.00# dladm show-link

e1000g0         type: non-vlan  mtu: 1500       device: e1000g0  
e1000g1         type: non-vlan  mtu: 1500       device: e1000g1  
e1000g2         type: non-vlan  mtu: 1500       device: e1000g2
  • Now plumbing:

bash-3.00# ifconfig e1000g2 plumb
bash-3.00# ifconfig e1000g2

e1000g2: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 4
        inet 0.0.0.0 netmask 0
        ether 00:E0:9F:67:98:fb

Assing IP and bring it up.
This one is well known.

bash-3.00# ifconfig e1000g2 inet 192.2.2.3/24 up
bash-3.00# ifconfig e1000g2

e1000g2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 4  
 inet 192.2.2.3 netmask ffffff00 broadcast 192.2.2.255  
        ether 00:E0:9F:67:98:fb

Make this change permanent
So far so good. But if youo restart the machine now it will lose its interface settings. To save them you create a text file named /etc/hostname. In my case it will be /etc/hostname.e1000g2 , this alone would plumb interface on start, and now put the IP address inside it in the form '192.2.2.3/24' . That is it.

To see if interface is up or down as a device and its duplex/speed parameters:

bash-3.00# dladm show-dev

e1000g0         link: up        speed: 1000  Mbps       duplex: full  
e1000g1         link: up        speed: 1000  Mbps       duplex: full  
e1000g2         link: up        speed: 1000  Mbps       duplex: full

Create/delete logical interface In Cisco world you would call it assigning secondary ip to the interface.

bash-3.00# ifconfig e1000g1 addif 193.92.13.3/24
Created new logical interface e1000g1:1
bash-3.00# ifconfig e1000g1:1 up
bash-3.00# ifconfig e1000g1:1

e1000g1:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3   
inet 193.92.13.3 netmask ffffff00 broadcast 193.92.13.255 

Remove logical interface:

bash-3.00# ifconfig e1000g1 removeif 193.92.13.3
bash-3.00# ifconfig e1000g1:1

ifconfig: status: SIOCGLIFFLAGS: e1000g1:1: no such interface