添加網口bond0,並指定物理網口成員,模式指定的時候也可以指定為數值(0-6)
nmcli con add type bond ifname bond0 mode active-backup
nmcli con add type bond-slave ifname eth0 master bond0
nmcli con add type bond-slave ifname eth1 master bond0
啟動bond0和對應的物理網口成員
nmcli con up bond-slave-eth0
nmcli con up bond-slave-eth1
nmcli con up bond-bond0
刪除網口bond0和對應的物理網口成員=
nmcli con del bond-bond0
nmcli connection delete bond-slave-eth0
nmcli connection delete bond-slave-eth0
為什么添加的時候bond網口名稱為bond0,刪除的時候bond網口名稱為bond-bond0?
添加bond0后,終端回顯顯示添加bond-bond0成功,或者也可使用nmcli con show查看當前的網口列表,可看到device是bond0,name為bond-bond0。
# nmcli con add type bond ifname bond0 mode 0
Connection 'bond-bond0' (bdf82833-1761-43bd-8c44-xxxxxxxxxxxx) successfully added.
# nmcli con show
NAME UUID TYPE DEVICE
bond-bond0 bdf82833-1761-43bd-8c44-xxxxxxxxxxxx bond bond0
ens192 ad4a9bb7-3fab-4b96-b101-xxxxxxxxxxxx ethernet ens192
可以使用con-name指定網口名稱,如:
# nmcli con add type bond con-name bond0 ifname bond0 mode 0
更多配置可使用nmcli connection help