Linux双网卡绑定

实验镜像CentOS7

https://pan.baidu.com/s/1wwKbh-C0oSdIsQGwHFUv_Q

常见的网卡绑定驱动三种模式:

  1. Mode=0(balance-rr) 平衡负载模式:平时两块网卡均工作,且自动备援,但需要在与服务器本地网卡相连的交换机设备上进行端口聚合来支持绑定技术。
  2. Mode=1(active-backup) 自动备援模式:平时只有一块网卡工作,在它故障后自动替换为另外的网卡。
  3. Mode=6(balance-alb)平衡负载模式:平时两块网卡均工作,且自动备援,无须交换机设备提供辅助支持。

首先在虚拟机再添加一块网卡,两块网卡模式相同

修改网卡配置
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777736 
TYPE=Ethernet
BOOTPROTO=none
USERCTL=no
DEVICE=eno16777736
ONBOOT=yes
MASTER=bond0
SLAVE=yes
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno33554984 
TYPE=Ethernet
BOOTPROTO=none
DEVICE=eno33554984
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
TYPE=Ethernet
BOOTPROTO=none
USERCTL=no
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.200.10
PREFIX=24
NM_CONTROLLED=no
[root@localhost ~]# vi /etc/modprobe.d/bond.conf 
alias bond0 bonding
options bond0 miimon=100 mode=6
[root@localhost ~]# systemctl restart network
[root@localhost ~]# ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500
        inet 192.168.200.10  netmask 255.255.255.0  broadcast 192.168.200.255
        inet6 fe80::20c:29ff:fee3:97cf  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:e3:97:cf  txqueuelen 0  (Ethernet)
        RX packets 14110  bytes 924830 (903.1 KiB)
        RX errors 0  dropped 8226  overruns 0  frame 0
        TX packets 10880  bytes 689514 (673.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno16777736: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether 00:0c:29:e3:97:cf  txqueuelen 1000  (Ethernet)
        RX packets 5806  bytes 395602 (386.3 KiB)
        RX errors 0  dropped 221  overruns 0  frame 0
        TX packets 6771  bytes 415514 (405.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno33554984: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
        ether 00:0c:29:e3:97:d9  txqueuelen 1000  (Ethernet)
        RX packets 8304  bytes 529228 (516.8 KiB)
        RX errors 0  dropped 8005  overruns 0  frame 0
        TX packets 4109  bytes 274000 (267.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 32  bytes 2780 (2.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 2780 (2.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值