配置之前主机状态
两块网卡工作在同一模式下
网卡eth0有配置,静态IP;网卡eth1是新增网卡,未做配置
[root@centos8 ~]#nmcli connection
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet eth0
Wired connection 1 3419a7c1-adaf-31b7-beea-d6f05361b4d2 ethernet eth1
配置 ,用nmcli命令实现bonding
1.添加bond设备下命令时需要6个声明:
1.1.设备类型type bond;
1.2.模式mode active-backup
1.3.设备名con-name mybond(自定义)
1.4.接口名ifname bond0(自定义)
1.5.指定ip地址ipv4.addresses
1.6.静态获取IP
nmcli connection add type bond con-name mybond0 ifname bond0 mode active-backup ipv4.addresses 10.0.0.200/24 ipv4.method manual
[root@centos8 ~]#nmcli connection add type bond mode active-backup con-name mybond0 ifname bond0 \
> ipv4.addresses 10.0.0.200/24 ipv4.method manual
Connection 'mybond0' (add87254-a324-4425-94d8-6ff7a1902d55) successfully added.
[root@centos8 ~]#nmcli connection
NAME UUID TYPE DEVICE
eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 ethernet eth0
Wired connection 1 3419a7c1-adaf-31b7-beea-d6f05361b4d2 ethernet eth1
mybond0 add87254-a324-4425-94d8-6ff7a1902d55 bond bond0
#设备名con-name:mybond0,接口名ifname:bond0,类型type:bond
#此时竟然可以连通bond设备配置的IP
[root@Centos6 ~]#ping 10.0.0.200
PING 10.0.0.200 (10.0.0.200) 56(84) bytes of data.
64 bytes from 10.0.0.200: icmp_seq=1 ttl=64 time=0.661 ms
64 bytes from 10.0.0.200: icmp_seq=2 ttl=64 time=1.47 ms
[root@centos7 ~]