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)平衡负载模式:平时两块网卡均工作,且自动备援,无须交换机设备提供辅助支持。

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

Linux双网卡绑定_第1张图片

修改网卡配置
[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  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
        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  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  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  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10
        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

 

你可能感兴趣的:(Linux)