Linux7配置team聚合鏈之主備模式
阿新 • • 發佈:2018-11-01
Linux7配置team聚合鏈
centos7、redhat7使用teaming實現聚合鏈路,能夠提升網絡卡繫結之後的網路吞吐效能,並且提供網絡卡故障後切換網絡卡處理的能力
team是基於小型核心驅動實現聚合鏈路,在使用者層提供teamd命令實現鏈路管理
teamd可以實現以下模式的聚合鏈路
broadcast 廣播容錯
roundrobin 負載輪詢
activebackup 主備
loadbalance 負載均衡
lacp 需要交換機支援lacp協議
- 主備模式
1. 新增一個team0 生成繫結網絡卡team0以及team0的配置檔案
nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'
2. 修改team0的配置
[ [email protected] ~]# nmcli connection modify ipv4.addresses 192.168.1.7/24 ipv4.gateway 8.8.8.8 ipv4.dns 8.8.8.8 ipv4.method manual
3.ping下剛才加的team0
[[email protected] ~]# ping 192.168.1.7
PING 192.168.1.7 (192.168.1.7) 56(84) bytes of data.
64 bytes from 192.168.1.7: icmp_seq=1 ttl=64 time=0.142 ms
...
4. 檢視team的狀態
[ [email protected] ~]# teamdctl team0 state
setup:
runner: activebackup
runner:
active port:
[[email protected] ~]#
5. 將網絡卡eno16777736繫結到team0上
[[email protected] ~]# nmcli connection add type team-slave con-name team0-port1 ifname eno16777736 master team0
Connection 'team0-port1' (afd6ff8c-6301-4140-af5f-6ca509136ae5) successfully added.
[ [email protected] ~]#
6.同理,第二塊網絡卡也是如此:
[[email protected] ~]# nmcli connection add type team-slave con-name team0-port2 ifname ens38 master team0
Connection 'team0-port2' (d0b22519-dbe6-4080-bf25-62eb0da7eacb) successfully added.
[[email protected] ~]#
7.現在team0鏈路上有互為主備的的網絡卡了
[[email protected] ~]# teamdctl team0 state
setup:
runner: activebackup
ports:
eno16777736
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
ens38
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: ens38
[[email protected] ~]#
//連線和裝置的狀態
[[email protected] ~]# nmcli device
DEVICE TYPE STATE CONNECTION
virbr0 bridge connected virbr0
eno16777736 ethernet connected team0-port1
ens38 ethernet connected team0-port2
team0 team connected team0
lo loopback unmanaged --
virbr0-nic tap unmanaged --
[[email protected] ~]# nmcli connection
NAME UUID TYPE DEVICE
virbr0 76a121d2-73ca-45fd-be24-60c5a46e5fdb bridge virbr0
eno16777736 be3b17c4-48df-4513-aa1d-a653b7a57cc2 802-3-ethernet --
team0-port1 fa3cb438-f7b9-430f-b050-8f1a3cfdbfc6 802-3-ethernet eno16777736
team0 a1ff597f-db0a-43e5-8076-c902e0df7290 team team0
team0-port2 09b59d72-2a52-4cad-be70-7187ed2e4ecd 802-3-ethernet ens38
ens33-dhcp 97ab866a-3136-4349-9961-c26524d8d408 802-3-ethernet --
[[email protected] ~]#
7.配置繫結網絡卡team0 結束,最後重啟一下team0和NetworkMnanger就可以了
[[email protected] ~]# nmcli connection down team0 && nmcli connection up team0