team支持的模式
broadcast:每个网卡都传送数据包
roundrobin:每个网卡轮询方式传送数据
activebackup:网卡之间有主备,主传送数据包,备的不传送,主网卡
down 了,备才传送
loadbalance:监控流量并使用哈希函数,使得每个网卡传送的数据包达到
相等
lacp:需要借助交换机,实现高级的负载均衡
查看示例文件
[root@localhost ~]# cd /usr/share/doc/teamd/example_configs/
[root@localhost example_configs]# ll
total 64
-rw-r--r--. 1 root root 305 Dec 9 2018 activebackup_arp_ping_1.conf
-rw-r--r--. 1 root root 465 Dec 9 2018 activebackup_arp_ping_2.conf
-rw-r--r--. 1 root root 194 Dec 9 2018 activebackup_ethtool_1.conf
-rw-r--r--. 1 root root 212 Dec 9 2018 activebackup_ethtool_2.conf
-rw-r--r--. 1 root root 241 Dec 9 2018 activebackup_ethtool_3.conf
-rw-r--r--. 1 root root 447 Dec 9 2018 activebackup_multi_lw_1.conf
-rw-r--r--. 1 root root 285 Dec 9 2018 activebackup_nsna_ping_1.conf
-rw-r--r--. 1 root root 318 Dec 9 2018 activebackup_tipc.conf
-rw-r--r--. 1 root root 96 Dec 9 2018 broadcast.conf
-rw-r--r--. 1 root root 209 Dec 9 2018 lacp_1.conf
-rw-r--r--. 1 root root 98 Dec 9 2018 loadbalance_1.conf
-rw-r--r--. 1 root root 140 Dec 9 2018 loadbalance_2.conf
-rw-r--r--. 1 root root 183 Dec 9 2018 loadbalance_3.conf
-rw-r--r--. 1 root root 93 Dec 9 2018 random.conf
-rw-r--r--. 1 root root 244 Dec 9 2018 roundrobin_2.conf
-rw-r--r--. 1 root root 97 Dec 9 2018 roundrobin.conf
1.创建:去创建team连接以及team的虚拟网卡
[root@localhost~]# nmcli c add type team con-name team0 ifname
team_dev ipv4.addresses 192.168.179.121/24
ipv4.gateway 192.168.179.2
ipv4.dns 114.114.114.114
ipv4.method manual config'{"runner":"activebackup", "hwarrd_policy":"by_active"}'
2.绑定:把两张网卡绑定在team上
nmcli c add type team-slave con-name team_1 ifname ens160 master team_dev
nmcli c add type team-slave con-name team_2 ifname ens224 master team_dev
3.激活:激活team-slave和team0
nmcli c up team_1
nmcli c up team_2
nmcli c up team0
4.查询:查询teamdctl team_dev state
[root@rhce ~]# teamdctl team_dev state
setup:
runner: activebackup
ports:
ens160
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
ens224
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: ens160
使用windows去ping该网卡ip192.168.179.121
PS C:\Users\Administrator> ping -t 192.168.179.121
正在 Ping 192.168.231.131 具有 32 字节的数据:
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间=1ms TTL=64
使用xshell去ping www.baidu.com
root@localhost ~]# ping www.baidu.com
PING www.wshifen.com (103.235.46.39) 56(84) bytes of data.
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=1 ttl=128 time=55.1 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=2 ttl=128 time=61.6 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=3 ttl=128 time=97.3 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=4 ttl=128 time=65.4 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=5 ttl=128 time=86.3 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=6 ttl=128 time=110 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=7 ttl=128 time=133 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=8 ttl=128 time=154 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=9 ttl=128 time=69.8 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=10 ttl=128 time=87.2 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=11 ttl=128 time=106 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=12 ttl=128 time=73.9 ms
切换验证,down掉ens160接口
[root@localhost ~]# nmcli d disconnect ens160
查看window
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间=1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
来自 192.168.179.121 的回复: 字节=32 时间<1ms TTL=64
查看xshell
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=127 ttl=128 time=25.4 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=128 ttl=128 time=25.5 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=129 ttl=128 time=25.6 ms
64 bytes from 103.235.46.39 (103.235.46.39)): icmp_seq=130 ttl=128 time=25.7 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=131 ttl=128 time=25.6 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=132 ttl=128 time=25.7 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=133 ttl=128 time=25.7 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=134 ttl=128 time=25.6 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=135 ttl=128 time=25.6 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=136 ttl=128 time=25.6 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=137 ttl=128 time=25.7 ms
64 bytes from 103.235.46.39 (103.235.46.39): icmp_seq=138 ttl=128 time=26.1 ms
可以发现能够ping通,说明备用网卡在工作
down掉ens224
[root@localhost ~]# nmcli d disconnect ens224
查看windows
请求超时!
请求超时!
请求超时!
请求超时!
请求超时!
请求超时!
请求超时!
查看xshell
From localhost.localdomain (192.168.179.121) icmp_seq=464 Destination Host Unreachable
From localhost.localdomain (192.168.179.121) icmp_seq=465 Destination Host Unreachable
From localhost.localdomain (192.168.179.121) icmp_seq=466 Destination Host Unreachable
From localhost.localdomain (192.168.179.121) icmp_seq=467 Destination Host Unreachable
From localhost.localdomain (192.168.179.121) icmp_seq=468 Destination Host Unreachable