Friday, December 1, 2006

Network failover using Solaris multipathing - in.mapthd

Network failover using Solaris multipathing

Conventions

Network: 10.0.0.0/24
Hostname: acadie
Domain: internal
Interfaces: hme0 hme1 hme2
Failover group name: mofo
Main "live" address: 10.0.0.101
hme0 "test" address: 10.0.0.110
hme1 "test" address: 10.0.0.111
hme2 "test" address: 10.0.0.112

Configuration files

/etc/hosts:

# # Internet host table # 127.0.0.1   localhost               loghost 10.0.0.101  acadie.internal         acadie 10.0.0.110  acadie-hme0 10.0.0.111  acadie-hme1 10.0.0.112  acadie-hme2 

/etc/netmasks:

10.0.0.0        255.255.255.0 

/etc/hostname.hme0:

acadie netmask + broadcast + up \ group mofo \ addif acadie-hme0 netmask + broadcast + \ deprecated -failover up 

/etc/hostname.hme1:

acadie-hme1 netmask + broadcast + \ group mofo \ deprecated -failover standby up 

/etc/hostname.hme2:

acadie-hme2 netmask + broadcast + \ group mofo \ deprecated -failover standby up 

Command line

The above configuration is all that is required to make this configuration persistent across reboots. If, however, you are in the position of having to implement this on a running machine without rebooting, you pretty much just run `ifconfig` for each interface, with the arguments shown in the /etc/hostname.hme? files above.

For example, if you're already up and running on hme0, and want to add hme1 and hme2 as failover interfaces to hme0:

acadie# ifconfig hme0 hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2         inet 10.0.0.101 netmask ffffff00 broadcast 10.0.0.255         ether 8:0:20:c5:10:15 

Assign hme0 to your failover group, and add an alias to it for the testing address:

acadie# ifconfig hme0 group mofo acadie# ifconfig hme0 addif 10.0.0.110 netmask 255.255.255.0 \     broadcast 10.0.0.255 -failover deprecated up 

Then add hme1 and hme2 in:

acadie# ifconfig hme1 plumb 10.0.0.111 netmask 255.255.255.0 \     broadcast 10.0.0.255 group mofo deprecated -failover standby up acadie# ifconfig hme2 plumb 10.0.0.112 netmask 255.255.255.0 \     broadcast 10.0.0.255 group mofo deprecated -failover standby up 

Note: You can substitute in hostnames for the IP addresses in those ifconfig commands, provided they are in /etc/hosts.

acadie# ifconfig -a lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1         inet 127.0.0.1 netmask ff000000  hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2         inet 10.0.0.101 netmask ffffff00 broadcast 10.0.0.255         groupname mofo         ether 8:0:20:c5:10:15  hme0:1: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER> mtu 1500 index 2         inet 10.0.0.110 netmask ffffff00 broadcast 10.0.0.255 hme1: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,STANDBY,INACTIVE> mtu 1500 index 3         inet 10.0.0.111 netmask ffffff00 broadcast 10.0.0.255         groupname mofo         ether 8:0:20:c5:c0:53  hme2: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,STANDBY,INACTIVE> mtu 1500 index 4         inet 10.0.0.112 netmask ffffff00 broadcast 10.0.0.255         groupname mofo         ether 0:60:5b:e:2:dd  

No comments: