使用 nmtui 工具完成
nmtui > Edit a connection > Add > New Connection > Select Bond > Create
> Slaves > Add
> IPv4 Configuration
> IPv6 Configuration > Ignore
TIP:
Profile Name 的名稱會與實際設定檔名 ifcfg-XXX 有關,上述的設定會產生設定檔
ifcfg-bond0 , ifcfg-eno1-slave如果 Profile Name 設定錯了要修改,必須移除整個 Bond 設定,然後再重建;如果直接修改設定,關聯的設定檔名稱 ifcfg-XXX 並不會一起被更新,這會造成爾後管理上的困擾。
變更 Bonding 模式
預設模式是使用 Load Balancing (Round-Robin),將它變更為 Acitve-Backup
nmtui > Edit a connection > Bond: bond0 > Edit >
NOTE:
如果要使用預設的 Round-Robin 模式,網卡所連結的 Switch 設備必須設定 EtherChannel,否則 Switch 設備會偵測到 vlan XX is flapping between port YYY and port ZZZ。
重啟網路服務
注意:
// 注意:如果有使用 iSCSI Disks,重啟網路服務可能造成系統其他問題 systemctl restart network.service or nmcli networking off; modprobe -r bonding ; nmcli networking on
停用 NetworkManager 服務
#> service NetworkManager stop #> chkconfig NetworkManager off
新增設定
#> vi /etc/modprobe.d/bond.conf alias bond0 bonding #> vi /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 BOOTPROTO=none IPADDR=10.4.1.110 NETMASK=255.255.255.0 NETWORK=10.4.1.0 GATEWAY=10.4.1.254 DNS1=192.168.21.12 DOMAIN=xxx.com ONBOOT=yes BONDING_OPTS="mode=1 primary=eth0 miimon=100" #> modinfo bonding filename: /lib/modules/2.6.32-573.el6.x86_64/kernel/drivers/net/bonding/bonding.ko author: Thomas Davis, tadavis@lbl.gov and many others description: Ethernet Channel Bonding Driver, v3.7.1 version: 3.7.1 license: GPL alias: rtnl-link-bond srcversion: 4E0AE4BD567D42DFB061C63 ... #> vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 MASTER=bond0 SLAVE=yes BOOTPROTO=none HWADDR=00:26:55:??:??:?? ONBOOT=yes USERCTL=no #> vi /etc/sysconfig/network-scripts/ifcfg-eth2 DEVICE=eth2 MASTER=bond0 SLAVE=yes BOOTPROTO=none HWADDR=3C:A8:2A:??:??:?? ONBOOT=yes USERCTL=no
TIPs:
如果要用 Port Trunking (802.3ad 又稱 LCAP: Link Aggregation Control Protocol),可以將 mode 設成 4,注意:在 network switch 端也必須做相應的設定。
檢查 bond0 狀態
# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: fault-tolerance (active-backup) Primary Slave: eth0 (primary_reselect always) Currently Active Slave: eth0 MII Status: up MII Polling Interval (ms): 100 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:26:55:da:2a:a0 Slave queue ID: 0 Slave Interface: eth2 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 3c:a8:2a:0b:2b:80 Slave queue ID: 0
Images 0 | ||
---|---|---|
No images to display in the gallery. |