[步骤] bond 网卡捆绑组的添加(CentOS Linux & RHEL 版)

步骤一:显示现有的网卡有哪些

# nmcli connection show

步骤二:添加网卡捆绑组

2.1 添加网卡捆绑组

2.1.1 添加网卡捆绑组的格式
# nmcli connection add type bond con-name <connection name of network card binding group> ifname <name of network card binding group> mode <network card binding group type> miimon <delay time>
2.1.2 添加网卡捆绑组的案例
# nmcli connection add type bond con-name bond0 ifname bond0 mode active-backup miimon 100

(补充:这里以创建连接名为 bond0 设备名为 bond0 延迟为 100 毫秒的网卡捆绑组为例)

2.2 添加网卡捆绑组的子网卡

2.2.1 添加网卡捆绑组子网卡的格式
# nmcli connection add type bond-slave con-name <network card connection name> ifname <subnet card name> master <network card binding group type>
2.2.2 添加网卡捆绑组子网卡的案例
# nmcli connection add type bond-slave con-name eth0 ifname eth0 master bond0
# nmcli connection add type bond-slave con-name eth1 ifname eth1 master bond0

(补充:这里以将连接名为 eth0 和 eth1 的网卡添加到 bond0 网卡捆绑组为例)

步骤三:给网卡捆绑组配置 IP 地址

# nmcli connection modify bond0 ipv4.addresses 192.168.100.5/24 ipv4.gateway 192.168.100.1 autoconnect yes ipv4.method manual

(补充:这里给 bon0 网卡捆绑组添加 192.168.100.5/24 IP 地址,192.168.100.1 网关 IP 地址,开机自动启动并且把网卡设置成静态 IP 地址为例)

步骤四:启动网卡捆绑组

4.1 显示现有的网卡捆绑组和对应的子网卡有哪些

# nmcli connection show

4.2 启动网卡捆绑组里的子网卡

4.2.1 启动网卡捆绑组里子网卡的格式
# nmcli connection up <subnet card name>
4.2.2 启动网卡捆绑组里的子网卡
# nmcli connection up eth0
# nmcli connection up eth1

(补充:这里以重启 eth0 或者 eth1 为例)

或者:

# nmcli connection reload

4.3 启动网卡捆绑组

4.3.1 启动网卡捆绑组的格式
# nmcli connection up <connection name of network card binding group>
4.3.2 启动网卡捆绑组的案例
# nmcli connection up bond0

(补充:这里以启动 bond0 网卡组为例)

步骤五:确认网卡捆绑组的 IP 地址配置成功

# ip address show 

(补充:如果网卡组里出现了我们配置的 IP 地址,则代表 IP 地址配置成功)

步骤六:显示网卡捆绑组的子网卡

6.1 显示网卡捆绑组的成员格式
# cat /proc/net/bonding/<bond name>
6.2 显示网卡捆绑组的成员的案例
# cat /proc/net/bonding/bond0

(补充:这里以显示网卡组 bond0 的子网卡为例)