就Redhat的設定而言,如果安裝了X window則預設會是以Network Manager來管理網路設定。本文專注在使用手動設定TCP/IP網路設定。
Bonding on RHEL/Fedora
本文預設使用mode=6(也可以寫作mode=balance-alb)來作為範例,請先記得備份:cp /etc/sysconfig/network-scripts/ifcfg-eth{0,1} ~/Desktop就可以開始進行bonding實驗。
- 安裝必要的套件
- 修改/etc/modprobe.d/aliases.conf 新增一行alias:
- 關閉NetworkManager並啟動bonding: 相信在先前的章節你已經關閉了NetworkManager了...但是還是提醒一下就是了。
- 修改/etc/sysconfig/network-scripts/ifcfg-*: 假設你要bond eth0, eth1兩張NIC到192.168.10.198/24,
- 重新啟動網路服務:
yum install iputilsiputils套件包含了重要的ifenslave指令,他是RHEL預設就會安裝的套件。
alias bond0 bonding(備註) 在一些比較早期的版本裡可能需要寫在/etc/modprobe.conf。
service NetworkManager stop
chkconfig NetworkManager off
modprobe bond0
ifcfg-eth0 | ifcfg-eth1 | ifcfg-bond0 |
---|---|---|
DEVICE=eth0
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no |
DEVICE=eth1
BOOTPROTO=none
NM_CONTROLLED=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no |
DEVICE=bond0 TYPE=bonding BOOTPROTO=static IPADDR=192.168.10.198 NETMASK=255.255.255.0 GATEWAY=192.168.10.1 ONBOOT=yes USERCTL=no NM_CONTROLLED=no BONDING_OPTS="mode=6 miimon=100 updelay=200 downdelay=200" |
service network restart如果沒有錯誤訊息的話,使用ip a指令來查看一切是否設定正確:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000 link/ether 84:34:97:11:00:d8 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP qlen 1000 link/ether 84:34:97:11:00:d9 brd ff:ff:ff:ff:ff:ff 4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether 84:34:97:11:00:d8 brd ff:ff:ff:ff:ff:ff inet 192.168.10.198/24 brd 192.168.10.255 scope global bond0 inet6 fe80::8634:97ff:fe11:d8/64 scope link valid_lft forever preferred_lft forever我們可以發現此時bond0的MAC位置跟eth0相同,原因是現在Mode6(balance-alb)主要的slave是eth0。可以查看bonding狀態來求證:
cat /proc/net/bonding/bond0看起來會是這個樣子:
Bonding Mode: adaptive load balancing Primary Slave: None Currently Active Slave: eth0 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 200 Down Delay (ms): 200 Slave Interface: eth0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 84:34:97:11:00:d8 Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 84:34:97:11:00:d9 Slave queue ID: 0
當然你也可以把bonding設定為dhcp!很簡單吧!
參考文章:
Share |
沒有留言:
張貼留言