对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
注:p1p1 p1p2 为物理网卡的名字
bond的mode如下:
balance-rr (0) --轮询模式(bond默认的模式)
active-backup (1) --主备模式(常用)
balance-xor (2)
broadcast (3)
802.3ad (4) --聚合模式
balance-tlb (5)
balance-alb (6)
--------------------------------------------------------------
3)修改bond0网卡配置
---------------------------------------------------------------
cd /etc/sysconfig/network-scripts
[root@XACR-aliware04 network-scripts]# vimifcfg-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 ---配置网关
保存并退出
---------------------------------------------------------------
4)重启网络
systemctl restart network �C重启网络服务
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
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
Permanent HW addr: f4:e9:d4:9a:f1:a2
Slave queue ID: 0
----------------------------------------------------------------
---到此就完成bond配置了---
原文链接:https://www.f2er.com/centos/380769.html