centos7和centos6的bond0配置

通过两个网卡设置主备模式,已达到更加安全的措施。当一块网卡坏时,另一块网卡会自动补充上去,以此来实现热备的效果
centos7设置bond
1:加2块网卡(最好相同的)
2:设置bond0
查看:

[root@localhost network-scripts]# nmcli connection show 
NAME                UUID                                  TYPE            DEVICE 
ens38               66a3bea1-4d11-3369-ab1f-737ae0a38604  802-3-ethernet  ens38  
mage243             c96bc909-188e-ec64-3a96-6a90982b08ad  802-3-ethernet  ens33  
virbr0              af0712a1-1bcb-44d7-92b2-445e0e90790e  bridge          virbr0 
Wired connection 1  c3bc0416-5ac8-31f4-9fb4-fc15bba98416  802-3-ethernet  --     
Wired connection 2  a960b53a-dbfa-33f4-8a4a-d3c1b8848bb3  802-3-ethernet  --     
mage247             175a7d99-4ca2-4c1c-b641-18161b3a3790  802-3-ethernet  --     

3:设置bond0

[root@localhost network-scripts]# nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup

4:设置两个网卡

3.增加slave的方案给两块新加的网卡
[root@localhost network-scripts]# nmcli connection add con-name slave-38 ifname ens38 type ethernet master bond0 
Connection 'slave-38' (97708606-56ac-48aa-9014-c23a376c2379) successfully added.
[root@localhost network-scripts]# nmcli connection add con-name slave-39 ifname ens39 type ethernet master bond0 
Connection 'slave-39' (608dc1a0-9407-45be-a720-4c415b4b8488) successfully added.

5:配置bond0

[root@localhost network-scripts]# nmcli connection modify bond0 ipv4.method manual connection.autoconnect yes ipv4.addresses 20.20.20.20/24 ipv4.dns 8.8.8.8 ipv4.gateway 20.20.20.1

6:激活bond0

[root@localhost network-scripts]# nmcli connection up bond0

禁用及删除:

[root@localhost network-scripts]# nmcli connection down bond0  #禁用
[root@localhost network-scripts]# nmcli connection delete bond0
[root@localhost network-scripts]# nmcli connection delete slave-39
[root@localhost network-scripts]# nmcli connection delete slave-34

centos6配置bond0
1:添加2块网卡
2:创建bond文件

[root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-bond0

3:修改bond0文件:

[root@localhost network-scripts]# vim ifcfg-bond0 

DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth1"
BONDING_OPTS="miimon=100 mode=1"
IPADDR=4.4.4.4
NETMASK=255.255.255.0     

4:配置网卡文件:

[root@localhost network-scripts]# vim ifcfg-eth2 
DEVICE=eth2
TYPE=Ethernet
ONBOOT=yes
SLAVE=yes
MASTER=bond0
NM_CONTROLLED=no

[root@localhost network-scripts]# vim ifcfg-eth3 
DEVICE=eth3
TYPE=Ethernet
ONBOOT=yes
SLAVE=yes
MASTER=bond0
NM_CONTROLLED=no

5:重启网络服务

[root@localhost network-scripts]# service network restart
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值