Lab 網路拓譜圖(使用 Server A eth1 與 eth2 與 serverb eth1 )
4.1. 查看網路介面卡 (Server A)
1
2
3
4
5
6
7
8
9
10
11
[root@servera ~]# ip link1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 52:54:00:00:00:01 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 52:54:00:18:dc:c0 brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 52:54:00:12:92:6e brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 52:54:00:0d:ed:1e brd ff:ff:ff:ff:ff:ff
4.3. 創建 team master group (Server A)
1
2
[root@servera ~]# nmcli con add con-name team0 type team ifname team0 ipv4.addresses 192.168.100.100/24 ipv4.method manual team.runner activebackupConnection 'team0'(1f5a9d56-db22-4906-9f51-3cb3f0c83e54) successfully added.
4.4. 創建 team slave port (Server A)
1
2
3
4
[root@servera ~]# nmcli con add type team-slave con-name team0-eth1 ifname eth1 master team0Connection 'team0-eth1'(4e063a35-45d7-416d-9fc8-d8a64f62ec7d) successfully added.
[root@servera ~]# nmcli con add type team-slave con-name team0-eth2 ifname eth2 master team0Connection 'team0-eth2'(f41d78a6-7e4a-4a34-9bc1-dd78892e0c57) successfully added.
4.5. 啟用 team master & slave (Server A)
1
2
3
4
5
6
7
8
9
[root@servera ~]# nmcli con up team0Connection successfully activated (master waiting for slaves)(D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/232)[root@servera ~]# nmcli con up team0-eth1Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/235)[root@servera ~]# ip -4 a s team07: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 inet 192.168.100.100/24 brd 192.168.100.255 scope global noprefixroute team0
valid_lft forever preferred_lft forever
[root@servera ~]# teamdctl team0 state
setup:
runner: activebackup
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
eth2
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: eth2
Note
上述可以觀察目前流量均會走 eth2 網路介面卡。
4.6. 設定 ServerB 網路及啟用並發送 ICMP (Server B)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@serverb ~]# nmcli con add con-name eth1 ipv4.addresses 192.168.100.11/24 ipv4.method manual ifname eth1 type ethernet
Connection 'eth1' (ccd0e3f8-68dd-4e53-bb17-5be449874fe6) successfully added.
[root@serverb ~]# nmcli con up eth1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/484)
[root@serverb ~]# ip -4a s eth1
Option "-4a" is unknown, try "ip -help".
[root@serverb ~]# ip -4 a s eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
inet 192.168.100.11/24 brd 192.168.100.255 scope global noprefixroute eth1
valid_lft forever preferred_lft forever
[root@serverb ~]# ping 192.168.100.100
PING 192.168.100.100 (192.168.100.100) 56(84) bytes of data.
64 bytes from 192.168.100.100: icmp_seq=1 ttl=64 time=1.79 ms
64 bytes from 192.168.100.100: icmp_seq=2 ttl=64 time=0.974 ms
...
[root@servera ~]# ip link set eth2 down[root@servera ~]# teamdctl team0 statesetup:
runner: activebackup
ports:
eth1
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 1 eth2
link watches:
link summary: down
instance[link_watch_0]:
name: ethtool
link: down
down count: 1runner:
active port: eth1
Note
停用 eth2 網路卡會因綁定 Teaming 後會自動切換至 eth1 網路介面卡,並且 Server B 的 ICMP 封包發送不會因此而斷開。