配置IPMP

rainbowbridg發表於2007-03-06

做這個可以把2快網路卡綁成一個網口!

This article demostrates how to set up IPMP on a Solaris 8 host and configure a virtual IP.

Environment:
SunOS denitdb37 5.8 Generic_117350-28 sun4u sparc SUNW,Sun-Fire-V490

Prerequisites:
. a Solaris 8 host is networked to one VLAN via 2 NICs.
. /etc/netmask is configured correctly. e.g.,
# cat /etc/netmasks
10.101.155.0 255.255.255.0
. /etc/defaulterouter is configured correctly. e.g.,
# cat /etc/defaultrouter
10.101.155.1
# wc -l /etc/defaultrouter
0 /etc/defaultrouter
. mpathd is configured correctly. e.g.,
# grep -v ^# /etc/default/mpathd
FAILURE_DETECTION_TIME=10000
FAILBACK=yes
TRACK_INTERFACES_ONLY_WITH_GROUPS=yes



Procedure of IPMP setup on a Solaris 8 host
-------------------------------------------

0. modify /etc/hosts as follows:
127.0.0.1 localhost
10.101.155.123 denitdb37 denitdb37.den.xyz.com loghost
10.101.155.124 denitdb37-if0
10.101.155.125 denitdb37-if1

1. log onto the system console as root.

2. deconfigure the 2 NICs, e.g.:
# ifconfig ce0 unplumb
# ifconfig ce6 unplumb
# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000

3. plumb the 2 NICs.
# ifconfig ce0 plumb
# ifconfig ce6 plumb

4. configure IPMP on the 2 NICs.

4.1 configure the first interface.
# ifconfig ce0 denitdb37-if0 group denitdb37 deprecated netmask + broadcast + -failover up
Setting netmask of ce0 to 255.255.255.0
# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
ce0: flags=9040843 mtu 1500 index 5
inet 10.101.155.124 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:24:86:70

4.2 configure the second interface.
# ifconfig ce6 denitdb37-if1 group denitdb37 deprecated -failover netmask + broadcast + up
Setting netmask of ce6 to 255.255.255.0
denitdb37# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
ce0: flags=9040843 mtu 1500 index 5
inet 10.101.155.124 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:24:86:70
ce6: flags=9040843 mtu 1500 index 6
inet 10.101.155.125 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:0:f4:91

4.3 configure IP of the host
# ifconfig ce0 addif denitdb37 netmask + broadcast + failover up
Created new logical interface ce0:1
Setting netmask of ce0:1 to 255.255.255.0
# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
ce0: flags=9040843 mtu 1500 index 5
inet 10.101.155.124 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:24:86:70
ce0:1: flags=1000843 mtu 1500 index 5
inet 10.101.155.123 netmask ffffff00 broadcast 10.101.155.255
ce6: flags=9040843 mtu 1500 index 6
inet 10.101.155.125 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:0:f4:91
# netstat -rn

Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
10.101.155.0 10.101.155.123 U 1 5 ce0:1
10.101.155.0 10.101.155.123 U 1 0 ce0
10.101.155.0 10.101.155.123 U 1 3 ce6
default 10.101.155.1 UG 1 158
127.0.0.1 127.0.0.1 UH 2 190 lo0

5. verify IPMP is functioning

5.0 ssh the host ("ssh denitdb37" in this case), and verify the connection after the detatch & reattatch.

5.1 detatch the NIC to which the IP of the host is bound:
# if_mpadm -d ce0
Jul 6 21:37:16 denitdb37 in.mpathd[29]: Successfully failed over from NIC ce0 to NIC ce6
denitdb37# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
ce0: flags=89040842 mtu 1500 index 5
inet 10.101.155.124 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:24:86:70
ce6: flags=9040843 mtu 1500 index 6
inet 10.101.155.125 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:0:f4:91
ce6:1: flags=1000843 mtu 1500 index 6
inet 10.101.155.123 netmask ffffff00 broadcast 10.101.155.255

5.2 re-attatch the interface
# if_mpadm -r ce0
Jul 6 21:39:01 denitdb37 in.mpathd[29]: Successfully failed back to NIC ce0
# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
ce0: flags=9040843 mtu 1500 index 5
inet 10.101.155.124 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:24:86:70
ce0:1: flags=1000843 mtu 1500 index 5
inet 10.101.155.123 netmask ffffff00 broadcast 10.101.155.255
ce6: flags=9040843 mtu 1500 index 6
inet 10.101.155.125 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:0:f4:91

6. create IPMP configuration files (its verification is to be done by a reboot).
# cat /etc/hostname.ce0
denitdb37-if0 group denitdb37 deprecated -failover up addif denitdb37 netmask + failover up
# cat /etc/hostname.ce6
denitdb37-if1 group denitdb37 deprecated -failover netmask + up


Procedure of configuring a virtual IP on a IPMP host
----------------------------------------------------

1. configure the virtual IP on /etc/hosts.
# echo -e "10.101.155.126ttmp.vip.xyz.com" >> /etc/hosts

2. configure the VIP manually:
# ifconfig ce0 addif tmp.vip.xyz.com netmask + broadcast + failover up
Created new logical interface ce0:2
Setting netmask of ce0:2 to 255.255.255.0
# ifconfig -a
lo0: flags=1000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
ce0: flags=9040843 mtu 1500 index 2
inet 10.101.155.124 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:24:86:70
ce0:1: flags=1000843 mtu 1500 index 2
inet 10.101.155.123 netmask ffffff00 broadcast 10.101.155.255
ce0:2: flags=1000843 mtu 1500 index 2
inet 10.101.155.126 netmask ffffff00 broadcast 10.101.155.255
ce6: flags=9040843 mtu 1500 index 3
inet 10.101.155.125 netmask ffffff00 broadcast 10.101.155.255
groupname denitdb37
ether 0:14:4f:0:f4:91

3. verify by "if_mpadm".

4. update IPMP configuration:
# cat /etc/hostname.ce0
denitdb37-if0 group denitdb37 deprecated -failover up addif denitdb37 netmask + failover up addif tmp.vip.xyz.com netmask + failover up
# cat /etc/hostname.ce6
denitdb37-if1 group denitdb37 deprecated -failover netmask + up

5. reboot the host to verify the configuration files.

ref:

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7916042/viewspace-902979/,如需轉載,請註明出處,否則將追究法律責任。

相關文章