nmcli命令添加bond网口

添加网口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

学无止境,你说呢?
原文地址:https://www.cnblogs.com/moumouLiu/p/13677749.html