# 官方提供@yunTaoScripts 网络聚合 🔥🔥
# team
- 通过
nm-connection-editor
增加team0
,实现多网卡组合。
[root@rhel8-100 ~]# nmcli device status
DEVICE TYPE STATE CONNECTION
ens160 ethernet connected ens160
team0 team connected team-connection
virbr0 bridge connected (externally) virbr0
ens224 ethernet disconnected --
ens256 ethernet disconnected --
[root@rhel8-100 ~]# nmcli device disconnect team0
Device 'team0' successfully disconnected.
[root@rhel8-100 ~]# nmcli device status
DEVICE TYPE STATE CONNECTION
ens160 ethernet connected ens160
virbr0 bridge connected (externally) virbr0
ens224 ethernet disconnected --
ens256 ethernet disconnected --
[root@rhel8-100 ~]# nmcli device connect ens224
Device 'ens224' successfully activated with '8ced061c-10eb-4e5c-9b04-14aee76fc27d'.
[root@rhel8-100 ~]# nmcli device status
DEVICE TYPE STATE CONNECTION
ens160 ethernet connected ens160
team0 team connected team-connection
virbr0 bridge connected (externally) virbr0
ens224 ethernet connected team0 slave 1
ens256 ethernet disconnected --
- 查看当前使用网卡
[root@rhel8-100 ~]# teamdctl team0 state
setup:
runner: roundrobin
ports:
ens224
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
[root@rhel8-100 ~]# nmcli device
DEVICE TYPE STATE CONNECTION
ens160 ethernet connected ens160
team0 team connected team-connection
virbr0 bridge connected (externally) virbr0
ens224 ethernet connected team0 slave 1
ens256 ethernet disconnected --
lo loopback unmanaged --
virbr0-nic tun unmanaged --
[root@rhel8-100 ~]# nmcli device connect ens256
Device 'ens256' successfully activated with 'ee2ecbd1-f11a-45f2-bf81-847710423d28'.
[root@rhel8-100 ~]# teamdctl team0 state
setup:
runner: roundrobin
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
bond接口与team接口的区别:
- bond接口:仅支持2块网卡
- team接口:与bond接口功能类似,区别在于team不需要手动加载相应的内核模块,它有更强的拓展性,支持8块网卡
# bond
[root@rhel8-100 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v4.18.0-305.el8.x86_64
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens224
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0
Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:30:23:d9
Slave queue ID: 0
Slave Interface: ens256
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:30:23:e3
Slave queue ID: 0
[root@rhel8-100 ~]# nmcli device disconnect ens224
Device 'ens224' successfully disconnected.
[root@rhel8-100 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v4.18.0-305.el8.x86_64
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens256
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0
Slave Interface: ens256
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:30:23:e3
Slave queue ID: 0
# 通过ansible 配置网络聚合
[root@rhel8-100 home]# cat network-aggregation.yaml
---
- hosts: rhel8-102
vars:
network_connections:
- name: team0
interface_name: team0
state: up
type: team
ip:
dhcp4: no
gateway4: 192.168.26.2
dns:
- 192.168.26.2
address:
- 198.168.26.162/24
- name: team-slave1
state: up
interface_name: ens256
type: ethernet
master: team0
- name: team-slave2
state: up
interface_name: ens224
type: ethernet
master: team0
roles:
- rhel-system-roles.network
← 快速链接