Sunday, May 6, 2012

WebLogic whole server migration and wlsifconfig.sh

Generalities on the Whole Server Migration

http://docs.oracle.com/cd/E17904_01/core.1111/e12036/server_migration.htm

https://forums.oracle.com/forums/thread.jspa?messageID=4331554


more in this other post

in $DOMAIN_HOME/bin/server_migration there is this little script "wlsifconfig.sh", who is involved in the Virtual IP migration process - the core of the Server Migration really.

I have opened to see what it does.

There are 3 functions: listif(), removeif(), addif() (where if=network interface)


listif() does a "/sbin/ip -o addr", whose output is a bit intimidating:


1: lo: mtu 16436 qdisc noqueue \ link/loopback 00:00:0 0:00:00:00 brd 00:00:00:00:00:00
1: lo inet 127.0.0.1/8 scope host lo
1: lo inet6 ::1/128 scope host \ valid_lft forever preferred_lft foreve r
2: eth0: mtu 1500 qdisc pfifo_fast maste r bond0 qlen 1000\ link/ether 9c:3e:99:17:6c:90 brd ff:ff:ff:ff:ff:ff
2: eth0 inet 10.10.10.10/32 brd 10.10.10.10 scope global eth0
3: eth1: mtu 1500 qdisc pfifo_fast maste r bond0 qlen 1000\ link/ether 9c:3e:99:17:6c:90 brd ff:ff:ff:ff:ff:ff
4: sit0: mtu 1480 qdisc noop \ link/sit 0.0.0.0 brd 0.0.0.0
5: bond0: mtu 1500 qdisc noqueue \ l ink/ether 9c:8e:39:27:6c:90 brd ff:ff:ff:ff:ff:ff
5: bond0 inet 120.56.5.189/24 brd 10.56.5.255 scope global bond0
5: bond0 inet 120.56.5.183/24 brd 10.56.5.255 scope global secondary bond0:0
5: bond0 inet 120.56.5.182/24 brd 10.56.5.255 scope global secondary bond0:1
5: bond0 inet6 fe80::9e8a:99ff:fea7:6c90/64 scope link \ valid_lft fore ver preferred_lft forever


basically for every nic it gives you all info on its configuration (one day maybe I will understand all this)

The other command is

/sbin/ip -o addr | sed -n 's?.*inet \([0-9.]*\)\/[0-9]* .* \([^ ]*\)?\2 \1?p'

which gives a much more human output, the list of each NIC and its associated IP:

lo 127.0.0.1
eth0 10.10.10.10
bond0 10.56.5.189
bond0:0 10.56.5.183
bond0:1 10.56.5.182


The other function removeif() does a
ifconfig "ipaddress" down
ifconfig "ipaddress" 0.0.0.0


Finally addif() essentially does a
sudo /sbin/ifconfig (some parameter) up

interesting is also the Address Resolution Protocol PING:

/sbin/arping
it needs sudo, example:
sudo /sbin/arping 11.61.286.232

http://en.wikipedia.org/wiki/Arping



Anyway shell scripting is so cryptic that it hurts the eyes.

No comments: