首页 > 其他 > 详细

centos7配置网卡绑定

时间:2021-06-02 00:07:08      阅读:26      评论:0      收藏:0      [点我收藏+]

要求:将两张网卡绑定为一张网卡,em1为主,em2为备

一、将原来的两张网卡的配置文件备份

[root@localhost network-scripts]# mv ifcfg-em1 ifcfg-em1.bak
[root@localhost network-scripts]# mv ifcfg-em2 ifcfg-em2.bak

二、新建两张网卡新配置文件

[root@localhost network-scripts]# vim ifcfg-em1
TYPE=Ethernet
BOOTPROTO=none
USERCTL=no
DEVICE=em1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@localhost network-scripts]# vim ifcfg-em1
TYPE=Ethernet
BOOTPROTO=none
USERCTL=no
DEVICE=em2
ONBOOT=yes
MASTER=bond0
SLAVE=yes

三、新建ifcfg-bond0文件

[root@localhost network-scripts]# vim ifcfg-bond0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
DEVICE=bond0
IPADDR=34.34.30.21
NETMASK=255.255.255.0
GATEWAY=34.31.30.1
DNS1=8.8.8.8
DNS2=202.106.0.20
NM_CONTROLLED=no

四、新建/etc/modprobe.d/bond.conf文件

[root@localhost network-scripts]# vim /etc/modprobe.d/bond.conf
alias bond0 bonding
options bond0 miimon=100 mode=1

五、停止系统NetworkManager服务

[root@localhost network-scripts]# systemctl stop NetworkManager
[root@localhost network-scripts]# systemctl disable NetworkManager

六、重启network服务

[root@localhost network-scripts]# systemctl restart network

七、测试

将其中一张网卡网线拨出,网络没有影响

八、解绑

[root@localhost network-scripts]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# mv ifcfg-bond0 ifcfg-bond0.bak
[root@localhost network-scripts]# mv ifcfg-em1 ifcfg-em1-bond.bak 
[root@localhost network-scripts]# mv ifcfg-em2 ifcfg-em2-bond.bak 

将原来备份的网卡配置文件恢复

[root@localhost network-scripts]# mv ifcfg-em1.bak ifcfg-em1
[root@localhost network-scripts]# mv ifcfg-em2.bak ifcfg-em2

删除bonding

[root@localhost network-scripts]# rmmod bonding

重启network服务

[root@localhost network-scripts]# systemctl restart network

启动NetworkManager服务

[root@localhost network-scripts]# systemctl start NetworkManager
[root@localhost ~]# systemctl enable NetworkManager

 

centos7配置网卡绑定

原文:https://www.cnblogs.com/sky-cheng/p/14838788.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!