vim /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos_rd-nfs-01/root rd.lvm.lv=centos_rd-nfs-01/swap biosdevname=0 net.ifnames=0 rhgb quiet"
/etc/sysconfig/network-scripts
cp ifcfg-p3p1 ifcfg-p3p1.bak
mv ifcfg-p3p1 ifcfg-eth4
grub2-mkconfig -o /boot/grub2/grub.cfg
只要做完这步,然后重新启动 Linux 操作系统,通过 ip addr 可以看到网卡名称已经变为 eth0 ,网络能正常使用
reboot
[root@node1 ~]# cat /boot/config-3.10.0-957.el7.x86_64 |grep -i bonding
CONFIG_BONDING=m
[root@node1 network-scripts]# cp -a ifcfg-eth4 ifcfg-eth4.bak
[root@node1 network-scripts]# cp -a ifcfg-eth5 ifcfg-eth5.bak
[root@node1 network-scripts]# cp -a ifcfg-eth4.bak ifcfg-bond0
[root@node1 network-scripts]# cat ifcfg-eth4
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
HWADDR=b4:96:91:47:12:70
NAME=eth4
DEVICE=eth4
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
[root@node1 network-scripts]# cat ifcfg-eth5
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
HWADDR=b4:96:91:47:12:72
NAME=eth5
DEVICE=eth5
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
[root@node1 network-scripts]# cat ifcfg-bond0
TYPE=Bond
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=bond0
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.135.46
PREFIX=24
GATEWAY=192.168.135.1
DNS1=172.21.128.3
DNS2=172.21.128.2
DOMAIN=onepluscorp.cn
IPV6_PRIVACY=no
USERCTL=no
[root@RD-NFS-01 network-scripts]# paste ifcfg-eth4 ifcfg-eth5
TYPE=Ethernet TYPE=Ethernet
PROXY_METHOD=none PROXY_METHOD=none
BROWSER_ONLY=no BROWSER_ONLY=no
BOOTPROTO=none BOOTPROTO=none
DEFROUTE=yes DEFROUTE=yes
IPV4_FAILURE_FATAL=no IPV4_FAILURE_FATAL=no
IPV6INIT=yes IPV6INIT=yes
IPV6_AUTOCONF=yes IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy IPV6_ADDR_GEN_MODE=stable-privacy
HWADDR=b4:96:91:47:12:70 HWADDR=b4:96:91:47:12:72
NAME=eth4 NAME=eth5
DEVICE=eth4 DEVICE=eth5
ONBOOT=yes ONBOOT=yes
USERCTL=no USERCTL=no
MASTER=bond0 MASTER=bond0
SLAVE=yes SLAVE=yes
[root@RD-NFS-01 network-scripts]# diff ifcfg-eth4 ifcfg-eth5
12,14c12,14
< HWADDR=b4:96:91:47:12:70
< NAME=eth4
< DEVICE=eth4
---
> HWADDR=b4:96:91:47:12:72
> NAME=eth5
> DEVICE=eth5
[root@node1 network-scripts]# echo -e "alias bond0 bonding\noptions bond0 mode=6 miimon=100" >> /etc/modprobe.d/bonding.conf
[root@node1 network-scripts]# cat /etc/modprobe.d/bonding.conf
alias bond0 bonding
options bond0 mode=6 miimon=100
注意:
#mode=6代表负载均衡;两块网卡同时工作,增加网络带宽,不需要依赖物理交换机设置
#mode=1代表主备切换;只有一块网卡处于活动状态,活动网卡故障切换到备用网卡
#miimon=100代表网络链路检测频率100ms检查一次,如果出现问题则切换到备用网卡
[root@node1 network-scripts]# modprobe bonding
#验证bonding模块是否加载成功,出现如下结果则证明加载成功
[root@node1 network-scripts]# lsmod | grep bonding
bonding 152656 0
[root@node1 network-scripts]# systemctl restart network
[root@RD-NFS-01 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth4
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: b4:96:91:47:12:70
Slave queue ID: 0
Slave Interface: eth5
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: b4:96:91:47:12:72
Slave queue ID: 0
ifconfig
#出现bond0并且网络正常即可
原文:https://www.cnblogs.com/pansn/p/13158830.html