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

Friday, 10 October 2014

Setting Additional IP in Solaris

                         ADD ADDITIONAL IP’s


Well…Suppose a situation that, suddenly one of vendor told that we want to implement an application which needs two physical IP’s and two virtual IP’s.
Range of Subnets would be same.

OK… so let’s begin with adding New IP’s to System.

Generally there are 4 interfaces in Sparc Servers or depending upon HW config.


I don’t have Sparc now, so added 2 new interfaces to VM.

Go to VM settings




Click on add


 Click on Network adapter and then next




I had previously selected NAT so I continue with it, plz check in your setting that what is selected already and go with same.


This way I added 2 interfaces,

Well… Now I have to assign IP’s to them.

But before that I need to find the interfaces… right?

root@sol-test-1:>/#devfsadm

root@sol-test-1:>/#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.133 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:b:3:12

Nothing happened… I have only one interface,

There is one more command through which we know that how many interface we have


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

[**in sparc we will get all interfaces we have]

Still only one…

We need to reboot the System,

Normal init 6 will also work but just given a reconfiguration reboot

root@sol-test-1:>/#reboot -- -r

Now system is back,

root@sol-test-1:>/#who -b
   .       system boot  Oct 10 19:57

Well, Let’s check what happened?

root@sol-test-1:>/#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.133 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:b:3:12

Still… 1 interface,

No Problem, dladm will help



root@sol-test-1:>/#dladm show-dev
e1000g0         link: up        speed: 1000  Mbps       duplex: full
e1000g1         link: unknown   speed: 0     Mbps       duplex: unknown
e1000g2         link: unknown   speed: 0     Mbps       duplex: unknown

Super… we got 2 extra interfaces…

Now we have to assign IP to interfaces, Great…

First we need to plumb the Interfaces

root@sol-test-1:>/#ifconfig e1000g1 plumb
root@sol-test-1:>/#ifconfig e1000g2 plumb

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

Good…

Now assign IP

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

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

Inet for ip

netmask + & broadcast + means hey system, plz derive these values from existing netmask & broadcast

up means after setting these values plz bring this interface online.

OK… IP HAS BEEN SET…     n joy….

root@sol-test-1:>/#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.133 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:b:3:12
e1000g1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 192.168.234.168 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:b:3:1c
e1000g2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 4
        inet 192.168.234.169 netmask ffffff00 broadcast 192.168.234.255
        ether 0:c:29:b:3:26

Now I told my boss and vendor that IP’s are assigned… vendor came and installed the application and did the config…. Then reboot….

And BOOOOM…. All IP’s are gone…

OMG… I forgot to make them persistent,

So… before we did such mistake, let’s make it Permanent.

Make the entry of both IP’s in /etc/hosts

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

:wq!

Crete following file and enter the ip address of that interface

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

root@sol-test-1:>/#vi /etc/hostname.e1000g1
"/etc/hostname.e1000g1" [New file]
192.168.234.168

:wq!

root@sol-test-1:>/#vi /etc/hostname.e1000g2
"/etc/hostname.e1000g2" [New file]
192.168.234.169

:wq!

Now RELAX…



Cont……



No comments:

Post a Comment