CentOS 7使用nmcli配置网卡聚合链路

CentOS 7使用nmcli配置网卡聚合链路

CentOS7系列对多网卡的配置发生很大的改变,以下以基于RECL-7.0系列对actviebackup属性的配置笔记。

[[email protected] ~]#nmcli con show//蓝色粗体的网卡是本例配置的网卡
NAME UUID TYPE DEVICE
Ethernet connection 2 8afe67cc-20ef-4985-86c3-b8d3c9371fc9 802-3-ethernet ens34
Ethernet connection 3 0cf045a5-012c-46bd-9367-1139666871b5 802-3-ethernet ens35
eth0 ff18a078-5b66-4bb8-8bba-fafd426b9d39 802-3-ethernet ens32

# 创建一个名为team0并且属性为team的链路接口
[[email protected] ~]#nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name":"activebackup"}}'

# 为team0配置ip地址与网关
[[email protected] ~]#nmcli connection modify team0 ipv4.addresses "192.168.25.211/24 192.168.25.250"
# 为team0配置DNS
[[email protected] ~]#nmcli connection modify team0 ipv4.dns "192.168.10.86 192.168.10.87"
# 设置team0的属性为 manual
[[email protected] ~]#nmcli connection modify team0 ipv4.method manual

# 将ent34网卡口 加到team0接口
[[email protected] ~]#nmcli connection add type team-slave conn-name team-port1 ifname ens34 master team0

# 将ent35网卡口 加到team0接口
[[email protected] ~]#nmcli connection add type team-slave conn-name team-port2 ifnameens35master team0

# 启用接口中的网卡
[[email protected] ~]#nmcli connection up team-port1;nmcli connection up team-port2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/25)
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/26)

[[email protected] ~]#teamdctl team0 state view
setup:
runner: activebackup
ports:
ens34
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
ens35
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
runner:
active port: ens34 //当前team0的主接口

[[email protected] ~]#ifconfig team0
team0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.25.211 netmask 255.255.255.0 broadcast 192.168.25.255
inet6 fe80::20c:29ff:fea7:34b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:a7:03:4b txqueuelen 0 (Ethernet)
RX packets 55 bytes 4477 (4.3 KiB)
RX errors 0 dropped 70 overruns 0 frame 0
TX packets 61 bytes 8297 (8.1 KiB)
TX errors 0 dropped 9 overruns 0 carrier 0 collisions 0

[[email protected] ~]#teamnl team0 ports
4: ens35: up 1000Mbit FD
3: ens34: up 1000Mbit FD

[[email protected] ~]#teamnl team0 options
queue_id (port:ens35) 0
priority (port:ens35) 0
user_linkup_enabled (port:ens35) false
user_linkup (port:ens35) true
enabled (port:ens35) true
queue_id (port:ens34) 0
priority (port:ens34) 0
user_linkup_enabled (port:ens34) false
user_linkup (port:ens34) true
enabled (port:ens34) true
mcast_rejoin_interval 0
mcast_rejoin_count 0
notify_peers_interval 0
notify_peers_count 0
mode roundrobin

测试

开启一个ping 窗口,并禁用team0中的其中的一块网卡

[[email protected] ~]#nmcli device disconnect ens34

Tips:原则上ping 数据1个包都不会掉

7使用nmcli配置网卡聚合链路 CentOS7系列对多网卡的配置发生很大的改变,以下以基于RECL-7.0系列对actviebackup属性的配置笔记。 [[email protected]

本文由js9905com金沙网站-金沙澳门手机版网址发布于计算机,转载请注明出处:CentOS 7使用nmcli配置网卡聚合链路

您可能还会对下面的文章感兴趣: