IPエイリアスとマルチNICバインド(RHEL 5/RHEL 6)
26253 ワード
RHEL 6のネットワーク管理はRHEL 5と比較的大きな変更がある.
RHEL 5、6にはNetworkManagerがインストールされていますが、RHEL 5の2、3、4、5レベルではデフォルトでは有効になりません.
ただし、RHEL 6ではデフォルトで有効になっており、NetworkManagerはNICの状態を常に監視しており、NICパラメータを変更するとすぐに有効になります.サービスを再起動する必要はありません.
· IPエイリアス
· マルチNICバインド bonding
RHEL5
RHEL6
以下はRed Hat Enterprise Linux 6 Essentials eBookより抜粋切替テスト:
RHEL 5、6にはNetworkManagerがインストールされていますが、RHEL 5の2、3、4、5レベルではデフォルトでは有効になりません.
ただし、RHEL 6ではデフォルトで有効になっており、NetworkManagerはNICの状態を常に監視しており、NICパラメータを変更するとすぐに有効になります.サービスを再起動する必要はありません.
- [root@rhel5 ~]# chkconfig --list NetworkManager # NetworkManager
- NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
- [root@rhel6 ~]# chkconfig --list NetworkManager # NetworkManager
- NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
· IPエイリアス
- RHEL5:
- [root@rhel5 ~]# /etc/init.d/NetworkManager status
- NetworkManager
-
- [root@rhel5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
- # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
- DEVICE=eth0
- ONBOOT=yes
- TYPE=Ethernet
- BOOTPROTO=none
- IPADDR=192.168.1.90
- NETWORK=255.255.255.0
- GATEWAY=192.168.1.1
- DNS1=8.8.8.8
- DNS2=8.8.4.4
- [root@rhel5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0:1 # IP eht0:1
- # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
- DEVICE=eth0:1
- ONBOOT=yes
- TYPE=Ethernet
- BOOTPROTO=none
- IPADDR=192.168.2.90
- NETWORK=255.255.255.0
- DNS1=8.8.8.8
- DNS2=8.8.4.4
-
- [root@rhel5 ~]# ip add show eth0
- 7: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
- link/ether 00:0c:29:db:14:10 brd ff:ff:ff:ff:ff:ff
- inet 192.168.1.90/24 brd 192.168.1.255 scope global eth0
- inet 192.168.2.90/24 brd 192.168.2.255 scope global eth0:1
-
- RHEL6:
- [root@rhel6 ~]# /etc/init.d/NetworkManager status
- NetworkManager (pid 2808) is running...
-
- [root@rhel6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE=eth0
- ONBOOT=yes
- NM_CONTROLLED=yes
- TYPE=Ethernet
- BOOTPROTO=none
- HWADDR=00:0C:29:BF:45:80
- IPADDR=192.168.1.119
- NETWORK=255.255.255.0
- GATEWAY=192.168.1.1
- IPADDR2=192.168.2.119 # IP eth0 IP
- NETWORK=255.255.255.0
- DNS1=8.8.8.8 # /etc/resolv.conf "nameserver 8.8.8.8"
- DNS2=8.8.4.4
-
- [root@rhel6 ~]# ip add show eth0
- 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
- link/ether 00:0c:29:bf:45:80 brd ff:ff:ff:ff:ff:ff
- inet 192.168.1.119/24 brd 192.168.1.255 scope global eth0
- inet 192.168.2.119/24 brd 192.168.2.255 scope global eth0
· マルチNICバインド bonding
RHEL5
- [root@rhel5 ~]# cat /etc/modprobe.conf
- alias bond0 bonding
- options bonding miimon=100 mode=1 # 100ms ,HA
-
- [root@rhel5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
- DEVICE=bond0
- ONBOOT=yes
- TYPE=Ethernet
- BOOTPROTO=none
- IPADDR=192.168.1.90
- NETMASK=255.255.255.0
- [root@rhel5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE=eth0
- ONBOOT=yes
- TYPE=Ethernet
- BOOTPROTO=none
- MASTER=bond0
- SLAVE=yes
- [root@rhel5 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
- DEVICE=eth1
- ONBOOT=yes
- TYPE=Ethernet
- BOOTPROTO=none
- MASTER=bond0
- SLAVE=yes
-
- [root@rhel5 ~]# ifconfig
- bond0 Link encap:Ethernet HWaddr 00:0C:29:DB:14:10
- inet addr:192.168.1.90 Bcast:192.168.1.255 Mask:255.255.255.0
- inet6 addr: fe80::20c:29ff:fedb:1410/64 Scope:Link
- UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
- RX packets:1229 errors:0 dropped:0 overruns:0 frame:0
- TX packets:589 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:92885 (90.7 KiB) TX bytes:78052 (76.2 KiB)
-
- eth0 Link encap:Ethernet HWaddr 00:0C:29:DB:14:10
- UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
- RX packets:530 errors:0 dropped:0 overruns:0 frame:0
- TX packets:291 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:40654 (39.7 KiB) TX bytes:40137 (39.1 KiB)
-
- eth1 Link encap:Ethernet HWaddr 00:0C:29:DB:14:10
- UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
- RX packets:714 errors:0 dropped:0 overruns:0 frame:0
- TX packets:310 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:53177 (51.9 KiB) TX bytes:39827 (38.8 KiB)
-
- [root@rhel5 ~]# cat /proc/net/bonding/bond0
- Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
-
- Bonding Mode: fault-tolerance (active-backup) #HA
- Primary Slave: None
- Currently Active Slave: eth0 # :eth0
- MII Status: up
- MII Polling Interval (ms): 100 # :100ms
- Up Delay (ms): 0
- Down Delay (ms): 0
-
- Slave Interface: eth0
- MII Status: up
- Link Failure Count: 0
- Permanent HW addr: 00:0c:29:db:14:10
-
- Slave Interface: eth1
- MII Status: up
- Link Failure Count: 0
- Permanent HW addr: 00:0c:29:db:14:1a
- [root@rhel6 ~]# cat /etc/modprobe.d/bonding.conf # RHEL5 /etc/modprobe.conf
- alias bond0 bonding
- [root@rhel6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
- DEVICE=bond0
- ONBOOT=yes
- BOOTPROTO=none
- NM_CONTROLLED=no
- IPADDR=192.168.1.119
- NETMASK=255.255.255.0
- BONDING_OPTS="MODE=0 MIIMON=1000" #1000ms ,LB
- [root@rhel6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE=eth0
- ONBOOT=yes
- NM_CONTROLLED=no
- TYPE=Ethernet
- BOOTPROTO=none
- MASTER=bond0
- SLAVE=yes
- [root@rhel6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
- DEVICE=eth1
- ONBOOT=yes
- NM_CONTROLLED=no
- TYPE=Ethernet
- BOOTPROTO=none
- MASTER=bond0
- SLAVE=yes
-
- [root@rhel6 ~]# ifconfig
- bond0 Link encap:Ethernet HWaddr 00:0C:29:BF:45:80
- inet addr:192.168.1.119 Bcast:192.168.1.255 Mask:255.255.255.0
- inet6 addr: fe80::20c:29ff:febf:4580/64 Scope:Link
- UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
- RX packets:3133 errors:0 dropped:0 overruns:0 frame:0
- TX packets:619 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:275036 (268.5 KiB) TX bytes:86282 (84.2 KiB)
-
- eth0 Link encap:Ethernet HWaddr 00:0C:29:BF:45:80
- inet addr:192.168.1.119 Bcast:192.168.1.255 Mask:255.255.255.0
- UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
- RX packets:2317 errors:0 dropped:0 overruns:0 frame:0
- TX packets:309 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:207976 (203.1 KiB) TX bytes:48317 (47.1 KiB)
-
- eth1 Link encap:Ethernet HWaddr 00:0C:29:BF:45:8A
- inet addr:192.168.1.119 Bcast:192.168.1.255 Mask:255.255.255.0
- UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
- RX packets:816 errors:0 dropped:0 overruns:0 frame:0
- TX packets:312 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:67060 (65.4 KiB) TX bytes:38801 (37.8 KiB)
- [root@rhel6 ~]# cat /proc/net/bonding/bond0
- Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
-
- Bonding Mode: load balancing (round-robin) #LB
- MII Status: up
- MII Polling Interval (ms): 1000 # 1000ms
- Up Delay (ms): 0 Down Delay (ms): 0
-
- Slave Interface: eth0
- MII Status: up
- Speed: 1000 Mbps
- Duplex: full Link
- Failure Count: 0
- Permanent HW addr: 00:0c:29:bf:45:80
- Slave queue ID: 0
-
- Slave Interface: eth1
- MII Status: up
- Speed: 1000 Mbps
- Duplex: full
- Link Failure Count: 0
- Permanent HW addr: 00:0c:29:bf:45:8a
- Slave queue ID: 0
以下はRed Hat Enterprise Linux 6 Essentials eBookより抜粋
- 1.For example, if two Ethernet interfaces are being channel bonded, both eth0 and eth1 may look like the following example: DEVICE=eth<N>
- BOOTPROTO=none
- ONBOOT=yes
- MASTER=bond0
- SLAVE=yes
- USERCTL=no
-
- 2.cp /etc/sysconfig/network-script/ifcfg-eth0 /etc/sysconfig/network-script/ifcfg-bond0
- DEVICE=bond0
- IPADDR=192.168.1.1
- NETMASK=255.255.255.0
- ONBOOT=yes
- BOOTPROTO=none
- USERCTL=no
- BONDING_OPTS="<bonding parameters separated by spaces>"
-
- 3.As root, create a new file named <bonding>.conf in the /etc/modprobe.d/ directory. Note that you can name this file anything you like as long as it ends with a .conf extension. Insert the following line in this new file:
- alias bond<N> bonding
-
- 4.You can configure each bond individually by manipulating the files located in the /sys/class/net/bond<N>/bonding/ directory. First, the bond you are configuring must be taken down:
- # ifconfig bond0 down
- As an example, to enable MII monitoring on bond0 with a 1 second interval, you could run (as root):
- # echo 1000 > /sys/class/net/bond0/bonding/miimon
- To configure bond0 for balance-alb mode, you could run either:
- # echo 6 > /sys/class/net/bond0/bonding/mode
- ...or, using the name of the mode:
- # echo balance-alb > /sys/class/net/bond0/bonding/mode
-
- Mode of operation : 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)
- 1). eth0 ,eth1 Slave , , eth1 ( eth0 )
- [root@rhel6 ~]# watch 'ip -s link show eth1' # 2s 'ip -s link show eth1'
- Every 2.0s: ip -s link show eth1 Wed Nov 21 02:13:48 2012
-
- 3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
- link/ether 00:0c:29:db:14:10 brd ff:ff:ff:ff:ff:ff
- RX: bytes packets errors dropped overrun mcast
- 137357 1916 0 0 0 0
- TX: bytes packets errors dropped carrier collsns
- 41562 441 0 0 0 0
-
- 2). eth0 ,eth1 Active ( ping -t 192.168.1.90 ), eth1
- [root@rhel5 ~]# ifdown eth0
- [root@rhel5 ~]# ifconfig
- bond0 Link encap:Ethernet HWaddr 00:0C:29:DB:14:10
- inet addr:192.168.1.90 Bcast:192.168.1.255 Mask:255.255.255.0
- inet6 addr: fe80::20c:29ff:fedb:1410/64 Scope:Link
- UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
- RX packets:13276 errors:0 dropped:0 overruns:0 frame:0
- TX packets:890 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:874191 (853.7 KiB) TX bytes:96900 (94.6 KiB)
-
- eth1 Link encap:Ethernet HWaddr 00:0C:29:DB:14:10
- UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
- RX packets:13276 errors:0 dropped:0 overruns:0 frame:0
- TX packets:890 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:1000
- RX bytes:874191 (853.7 KiB) TX bytes:96900 (94.6 KiB)
-
- [root@rhel5 ~]# cat /proc/net/bonding/bond0
- Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
-
- Bonding Mode: fault-tolerance (active-backup)
- Primary Slave: None
- Currently Active Slave: eth1
- MII Status: up
- MII Polling Interval (ms): 100
- Up Delay (ms): 0
- Down Delay (ms): 0
-
- Slave Interface: eth1
- MII Status: up
- Link Failure Count: 0
- Permanent HW addr: 00:0c:29:db:14:1a
-
- 3). eth0 ,eth0 Active ,
- [root@rhel5 ~]# ifup eth0
- [root@rhel5 ~]# ifconfig eth0
- eth0 Link encap:Ethernet HWaddr 00:0C:29:DB:14:10
- UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
- RX packets:2 errors:0 dropped:0 overruns:0 frame:0
- TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
- collisions:0 txqueuelen:0
- RX bytes:120 (120.0 b) TX bytes:0 (0.0 b)
- [root@rhel5 ~]# cat /proc/net/bonding/bond0
- Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
-
- Bonding Mode: fault-tolerance (active-backup)
- Primary Slave: None
- Currently Active Slave: eth1
- MII Status: up
- MII Polling Interval (ms): 1000
- Up Delay (ms): 0
- Down Delay (ms): 0
-
-
- Slave Interface: eth1
- MII Status: up
- Link Failure Count: 0
- Permanent HW addr: 00:0c:29:db:14:1a
-
- Slave Interface: eth0
- MII Status: up
- Link Failure Count: 0
- Permanent HW addr: 00:0c:29:db:14:10