Linux7.x通过命令配置网卡聚合双网卡绑定(Bond/team0)


1、用ifconfig命令可以看到主机现在有4个物理网口eno1、eno2、enp130s0f0、enp130s0f1
# ifconfig -a
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       ether 6c:92:bf:4c:70:b8  txqueuelen 1000  (Ethernet)
       RX packets 1047  bytes 84337 (82.3 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 473  bytes 52426 (51.1 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device memory 0xc7a20000-c7a3ffff  
 
eno2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       ether 6c:92:bf:4c:70:b9  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device memory 0xc7a00000-c7a1ffff  
 
enp130s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       ether 6c:92:bf:4c:70:b8  txqueuelen 1000  (Ethernet)
       RX packets 1192  bytes 282779 (276.1 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 146  bytes 19250 (18.7 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device memory 0xfbd80000-fbdfffff  
 
enp130s0f1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       ether 50:af:73:26:e1:05  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device memory 0xfbc80000-fbcfffff  
 
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 192  bytes 16800 (16.4 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 192  bytes 16800 (16.4 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
2、我已将eno1和enp130s0f0网卡插上网线,打算让这两个网卡聚合
 
3、首先创建一个team0的聚合连接
# nmcli connection  add con-name team0 type team ifname team0 config '{ "runner":{ "name":"activebackup" } }'
 
4、将插入网线的eno1和enp130s0f0两个网卡加入到team0的聚合连接内
# nmcli connection add type team-slave con-name team-port1 ifname eno1 master team0
# nmcli connection add type team-slave con-name team-port2 ifname enp130s0f0 master team0
 
5、配置team0的IP、掩码、网关(10.0.11.30、255.255.255.0、10.0.11.254)
# nmcli connection modify team0 ipv4.addresses "10.0.11.30/24 10.0.11.254"
 
6、激活聚合连接和成员网卡口(如用ifconfig -a已经查看到有team的IP已是10.0.11.30就不如要这部的操作了)
# nmcli  connection  up team0
# nmcli con up team-port1
# nmcli con up team-port2
 
5、完成
# ifconfig -a
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       ether 6c:92:bf:4c:70:b8  txqueuelen 1000  (Ethernet)
       RX packets 1047  bytes 84337 (82.3 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 473  bytes 52426 (51.1 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device memory 0xc7a20000-c7a3ffff  
 
eno2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       ether 6c:92:bf:4c:70:b9  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device memory 0xc7a00000-c7a1ffff  
 
enp130s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       ether 6c:92:bf:4c:70:b8  txqueuelen 1000  (Ethernet)
       RX packets 1192  bytes 282779 (276.1 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 146  bytes 19250 (18.7 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device memory 0xfbd80000-fbdfffff  
 
enp130s0f1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       ether 50:af:73:26:e1:05  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       device memory 0xfbc80000-fbcfffff  
 
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 192  bytes 16800 (16.4 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 192  bytes 16800 (16.4 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
team0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 10.0.11.30  netmask 255.255.255.0  broadcast 10.0.11.255
       inet6 fe80::6e92:bfff:fe4c:70b8  prefixlen 64  scopeid 0x20<link>
       ether 6c:92:bf:4c:70:b8  txqueuelen 0  (Ethernet)
       RX packets 1542  bytes 212556 (207.5 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 130  bytes 21437 (20.9 KiB)
       TX errors 0  dropped 1 overruns 0  carrier 0  collisions 0  
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM