Configuring a virtual interface in Solaris

Thursday, August 26, 2010

In this short article, we will see the steps to configure a virtual interface on Solaris, a virtual interface can be created for assigning multiple addresses to a physical interface and has several applications, the steps to create a virtual interface for a given physical interface is shown below.

1. Consider a physical interface

$ uname -a
SunOS qe9-proxy 5.10 Generic_139556-08 i86pc i386 i86pc
$ ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=201000843 mtu 1500 index 2
        inet 10.1.150.151 netmask ffffff00 broadcast 10.1.150.255
        ether 0:14:4f:28:29:34

2. If we want to create a virtual interface e1000g0:1 for the physical interface e1000g0 and assign an address 10.1.150.152 to the virtual interface, the command would be as follows.

2.1 Plumb the virtual interface e1000g0:1

$ ifconfig e1000g0:1 plumb
$ ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=201000843 mtu 1500 index 2
        inet 10.1.150.151 netmask ffffff00 broadcast 10.1.150.255
        ether 0:14:4f:28:29:34
e1000g0:1: flags=201000842 mtu 1500 index 2
        inet 0.0.0.0 netmask 0

2.2 Assign the IP address (10.1.150.152) to the virtual interface e1000g0:1

$ ifconfig e1000g0:1 10.1.150.152 netmask 255.255.255.0 broadcast + up
$ ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=201000843 mtu 1500 index 2
        inet 10.1.150.151 netmask ffffff00 broadcast 10.1.150.255
        ether 0:14:4f:28:29:34
e1000g0:1: flags=201000843 mtu 1500 index 2
        inet 10.1.150.152 netmask ffffff00 broadcast 10.1.150.255

Note: There is no Ethernet address displayed for the virtual interface as shown above (obviously)

2.3 Test the reachability of the IP address served by the virtual interface

$ ping -s 10.1.150.152
PING 10.1.150.152: 56 data bytes
64 bytes from 10.1.150.152: icmp_seq=0. time=0.113 ms
64 bytes from 10.1.150.152: icmp_seq=1. time=0.101 ms
^C
----10.1.150.152 PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip (ms)  min/avg/max/stddev = 0.101/0.107/0.113/0.0085
$

Using the above procedure, one can create several virtual interfaces (like e1000g0:2, e1000g0:3 and so on for the physical interface e1000g0), to disable a virtual interface, use the unplumb command (like ifconfig  e1000g0:1 unplumb), similar to the we used to unplumb a physical interface.

2 comments:

prashanthms said...

Sir this is prashanth from Banglore your blog very informative im yet novice to computer world,will you plz provide more info about virtual memory concept in OS...

Anonymous said...

Wow you are awesome,
excellent steps to configure...
before Google i check your resolutions
keep up , great work

Augie(India)


Copyright © 2016 Prasanna Seshadri, www.prasannatech.net, All Rights Reserved.
No part of the content or this site may be reproduced without prior written permission of the author.