在CentOS7實現bond
(1)創建bond配置文件
[root@centos7/etc/sysconfig/network-scripts]#nmcli connection add con-name bond0 type bond ifname bond0 mode active-backup
(2)綁定網卡
[root@centos7/etc/sysconfig/network-scripts]#nmcli connection add type bond-slave ifname eth0 master bond0
[root@centos7/etc/sysconfig/network-scripts]#nmcli connection add type bond-slave ifname eth1 master bond0
注意:如無爲從屬接口提供連接名,則該名稱是接口名稱加類型構成
(3)啓動綁定,必須從從屬接口先啓動
[root@centos7/etc/sysconfig/network-scripts]#nmcli connection up bond-slave-eth0
[root@centos7/etc/sysconfig/network-scripts]#nmcli connection up eth1-bond0
[root@centos7#]nmcli con up bond0
(4)測試,我這裏有兩塊網卡,先關閉一塊看看效果
上述是沒有down時的狀態。下圖是down以後的狀態。
(5)刪除bond
(a)先down,如果直接down bond0配置文件,從屬的都被down
(b)刪除配置文件
[root@centos7~]#nmcli connection delete bond0
[root@centos7~]#nmcli connection delete bond-slave-eth0
[root@centos7~]#rm -rf /etc/sysconfig/network-scripts/ifcfg-eth1-bond0