对p1p1 p1p2两张万兆网卡做bond步骤
1) 做之前请对各网卡配置进行备份
1 使用root账号登录服务器
2 cp p1p1 p1p2 网卡的初始配置到tmp 目录下,进行备份。
[root@XACR-aliware04 ~]# cd /etc/sysconfig/network-scripts/ [root@XACR-aliware04 network-scripts]# cp ifcfg-p1p1 /tmp [root@XACR-aliware04 network-scripts]# cp ifcfg-p1p2 /tmp |
2) 使用nmcli命令配置bond
生成bond配置
nmcli con add type bond ifname bond0 mode 1 nmcli con add type bond-slave ifname p1p1 master bond0 nmcli con add type bond-slave ifname p1p2 master bond0 |
3) 修改bond0网卡配置
修改下面表格中标红的内容
cd /etc/sysconfig/network-scripts [root@XACR-aliware04 network-scripts]# vim ifcfg-bond-bond0 DEVICE=bond0 BONDING_OPTS=mode=active-backup TYPE=Bond BONDING_MASTER=yes BOOTPROTO=static ---将原来的dhcp 改成static DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no NAME=bond-bond0 UUID=f4146d29-d694-4f13-ae59-56f940c7d120 ONBOOT=yes IPADDR=192.168.80.7 ---配置分配给服务器的IP地址 PREFIX=24 --配置子网掩码 GATEWAY=192.168.80.1 ---配置网关
注:将下面ipv6 相关的都删除 IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no
保存并退出 |
4) 重启网络
systemctl restart network –重启网络服务
cat /proc/net/bonding/bond0 ---查看bond0接口的相关信息
[root@XACR-aliware04 network-scripts]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: p1p2 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0
Slave Interface: p1p1 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 2 Permanent HW addr: f4:e9:d4:9a:f1:a0 Slave queue ID: 0
Slave Interface: p1p2 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 2 Permanent HW addr: f4:e9:d4:9a:f1:a2 Slave queue ID: 0 |
---到此就完成bond配置了---