Wise people learn when they can; fools learn when they must - Arthur Wellesley

Friday, 10 October 2014

Virtual IP Setting in Solaris

                     
                           VIRTUAL IP

Suppose, we need some more IP’s but we have only one Interface.

IP which sits on the same physical interface virtually and it acts as parasite.

Means it will share the BW of physical interface,

We have only one interface and we want 2 Virtual IP. Technically it is possible but it will on cost of BW sharing which results in highly degraded performance*
Depending on what type of applications are running/using that IP’s.


So… I have one Physical Interface and I will configure 2 virtual Ip on that interface means total 3 ip’s will run on that interface.

root@sol-test-2:>/# ifconfig -a |grep e100*
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2

root@sol-test-2:>/# dladm show-dev
e1000g0         link: up        speed: 1000  Mbps       duplex: full

Now I will configure Virtual Ip

First we need to Plumb the Virtual Interfaces,

root@sol-test-2:>/# ifconfig e1000g0:1 plumb
root@sol-test-2:>/# ifconfig e1000g0:2 plumb

Let’s see what happened…

root@sol-test-2:>/# ifconfig -a |grep e100*
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
e1000g0:1: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
e1000g0:2: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2

Also check the dladm,

root@sol-test-2:>/# dladm show-dev
e1000g0         link: up        speed: 1000  Mbps       duplex: full

Nothing … those interface are Virtual yaar… so how could they reflect in Physical settings?

Got it…

Now assign IP’s to them…

root@sol-test-2:>/# ifconfig e1000g0:1 inet 192.168.234.198 netmask + broadcast + up
Setting netmask of e1000g0:1 to 255.255.255.0

root@sol-test-2:>/# ifconfig e1000g0:2 inet 192.168.234.199 netmask + broadcast + up
Setting netmask of e1000g0:2 to 255.255.255.0

root@sol-test-2:>/# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.134 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:48:1d:e7
e1000g0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.198 netmask ffffff00 broadcast 192.168.234.255
e1000g0:2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.199 netmask ffffff00 broadcast 192.168.234.255

Great… But don’t forget to make it persistent, Otherwise One reboot and BOOOMM

root@sol-test-2:>/# vi /etc/hosts
"/etc/hosts" [Read only] 6 lines, 97 characters
#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
192.168.234.134 sol-test-2      loghost
192.168.234.198 sol-test-2
192.168.234.199 sol-test-2

:wq!

Make the entry of New IP’s with same host name.

And also create /etc/hostname.e1000g0:* with entry of respective ip

#vi /etc/hostname.<name of interface>

root@sol-test-2:>/# vi /etc/hostname.e1000g0:1
"/etc/hostname.e1000g0:1" [New file]
192.168.234.198

root@sol-test-2:>/# vi /etc/hostname.e1000g0:2
"/etc/hostname.e1000g0:2" [New file]
192.168.234.199

Now Done…

Just rebooted the system and…



root@sol-test-2:>/# who -b
   .       system boot  Oct 10 20:50


root@sol-test-2:>/# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.134 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:48:1d:e7
e1000g0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.198 netmask ffffff00 broadcast 192.168.234.255
e1000g0:2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.199 netmask ffffff00 broadcast 192.168.234.255



Now all set…

No comments:

Post a Comment