Team网卡绑定
实验要求:在当前主机添加两块网卡,将两块网卡绑定实现网卡冗余操作
添加网卡
关闭虚拟机,点击虚拟机设置,添加两个网卡。并且通过nmcli device connect ens224 命令激活网卡
创建虚拟team网卡,并绑定网卡
[root@localhost ~]
Connection 'team0' (a9b9399c-4650-4f50-840c-42864b7321bc) successfully added.
con-name 会话文件名
ifname 设备名
config '{"runner": {"name": "activebackup"}}' 选择team工作模式——主备
Team工作模式
[root@localhost ~]
total 64
-rw-r--r--. 1 root root 305 Jul 26 2020 activebackup_arp_ping_1.conf
-rw-r--r--. 1 root root 465 Jul 26 2020 activebackup_arp_ping_2.conf
-rw-r--r--. 1 root root 194 Jul 26 2020 activebackup_ethtool_1.conf
-rw-r--r--. 1 root root 212 Jul 26 2020 activebackup_ethtool_2.conf
-rw-r--r--. 1 root root 241 Jul 26 2020 activebackup_ethtool_3.conf
-rw-r--r--. 1 root root 447 Jul 26 2020 activebackup_multi_lw_1.conf
-rw-r--r--. 1 root root 285 Jul 26 2020 activebackup_nsna_ping_1.conf
-rw-r--r--. 1 root root 318 Jul 26 2020 activebackup_tipc.conf
-rw-r--r--. 1 root root 96 Jul 26 2020 broadcast.conf
-rw-r--r--. 1 root root 209 Jul 26 2020 lacp_1.conf
-rw-r--r--. 1 root root 98 Jul 26 2020 loadbalance_1.conf
-rw-r--r--. 1 root root 140 Jul 26 2020 loadbalance_2.conf
-rw-r--r--. 1 root root 183 Jul 26 2020 loadbalance_3.conf
-rw-r--r--. 1 root root 93 Jul 26 2020 random.conf
-rw-r--r--. 1 root root 244 Jul 26 2020 roundrobin_2.conf
-rw-r--r--. 1 root root 97 Jul 26 2020 roundrobin.conf
activebackup 主备
broadcast 广播
lacp 动态链路聚合
loadbalance 负载均衡
random 随机
roundrobin 轮循
打开对应的配置文件,获取相应的配置参数
[root@localhost example_configs]
激活从设备,主设备
给虚拟网卡添加两个从接口
[root@localhost ~]
Connection 'team0-port1' (31d8a0d1-4b5e-45db-92c8-b582cc87369d) successfully added.
[root@localhost ~]
Connection 'team0-port2' (66bef96c-4a57-440a-ade2-d7564c31d348) successfully added.
team-slave 定义为team-slave类型
[root@localhost ~]
NAME UUID TYPE DEVICE
team0 a9b9399c-4650-4f50-840c-42864b7321bc team team0
ens160 40da80dd-550a-4230-9eac-5b91a2225793 ethernet ens160
Wired connection 1 02a53879-7e45-398e-a470-cdd7ed03e265 ethernet ens224
Wired connection 2 6ff28c60-be96-3362-96e7-3b9553d7b626 ethernet ens256
team0-port1 31d8a0d1-4b5e-45db-92c8-b582cc87369d ethernet --
team0-port2 66bef96c-4a57-440a-ade2-d7564c31d348 ethernet --
如果添加错误可以通过[root@localhost ~]# nmcli connection delete uuid 66bef96c-4a57-440a-ade2-d7564c31d348 来删除已经添加的从接口
[root@localhost ~]
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
[root@localhost ~]
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@localhost ~]
激活两个从会话和主会话
测试
[root@localhost ~]
setup:
runner: activebackup
ports:
ens224
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
ens256
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: ens224
完成之后,可以通过team网卡的虚拟网卡找到真实网卡进行通信
|