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