Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Configure link aggregation in active and standby mode using nmcli

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Link aggregation in active and standby mode places one of the interfaces in a backup state and makes it active only if the active interface is disconnected.

Now let's configure the network card binding in CentOS 7 and run the ip link command to see which network cards can be used.

[root@localhost ~] # ip link1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00100 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 08: enp0s3: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 08:00:27:7b:d3:32 brd ff:ff:ff:ff:ff:ff3: enp0s8: mtu 1500 : 00:27:81:d3:be brd ff:ff:ff:ff:ff:ff

Here, enp0s3 and enp0s8 network cards are used to configure link aggregation in active and standby mode.

Create Team interface [root@localhost ~] # nmcli connection add type team con-name team0 ifname team0 config'{"runner": {"name": "activebackup"}} 'Connection' team0' (4df78635-b9fc-4539-ab02-27db11c656fe) successfully added.

Run nmcli con show to view the configuration of team0

[root@localhost] # nmcli con showNAME UUID TYPE DEVICE team0 4df78635-b9fc-4539-ab02-27db11c656fe team team0 enp0s3 5005942f-a7fd-4e55-b8e7-77928d8da72d ethernet enp0s3 Wired connection 1 45dee64a-53b3-3e2a-b2d4-e377f3e668a2 ethernet enp0s8

Add Slave Interfac

Here, enp0s3 and enp0s8 network cards are used as the slave interfaces of team0:

[root@localhost] # nmcli connection add type team-slave con-name team0-port1 ifname enp0s3 master team0Connection 'team0-port1' (15183c4a-2053-4b53-ad58-de5a07ae3ae9) successfully added. [root@localhost ~] # nmcli connection add type team-slave con-name team0-port2 ifname enp0s8 master team0Connection' team0-port2' (a34e20b0-3422-46e5-a947-bb2eaa6c0622) successfully added.

View port configuration information:

[root@localhost] # nmcli connection show NAME UUID TYPE DEVICE team0 4df78635-b9fc-4539-ab02-27db11c656fe team team0 enp0s3 5005942f-a7fd-4e55-b8e7-77928d8da72d ethernet enp0s3 Wired connection 1 45dee64a-53b3-3e2a-b2d4-e377f3e668a2 ethernet enp0s8 team0-port1 15183c4a-2053-4b53-ad58-de5a07ae3ae9 ethernet-- team0-port2 A34e20b0-3422-46e5-a947-bb2eaa6c0622 ethernet-

Assign IP addr

Assign a static IP address to team0 and start the team0 configuration:

[root@localhost ~] # nmcli connection modify team0 ipv4.method manual ipv4.addresses 192.168.0.200 24 ipv4.gateway 192.168.0.1 ipv4.dns 202.102.128.68 [root@localhost] # nmcli connection up team0 Connection successfully activated (master waiting for slaves) (D-Bus active path: / org/freedesktop/NetworkManager/ActiveConnection/4)

Check the connection configuration information and find that team0-port1 is not bound to enp0s3, a network card interface.

[root@localhost ~] # nmcli connection

This is within the ifcfg-team0-port1 configuration file and ifcfg-enp0s3 configuration files are set to boot

So we need to turn off the boot of enp0s3. Here we turn off the boot of both enp0s3 and Wired connection 1.

[root@localhost ~] # nmcli connection modify enp0s3 autoconnect no [root@localhost ~] # nmcli connection modify Wired\ connection\ 1 autoconnect no

Then restart the network service to view the link configuration:

[root@localhost ~] # systemctl restart network [root@localhost ~] # nmcli connection [root@localhost ~] # ip ad

You can see that both team0-port1 and team0-port2 are bound to the corresponding network card. The ip address of team0 shows 192.168.0.200 set manually.

Verification

View the status of team0:

[root@localhost ~] # teamdctl team0 statesetup: runner: activebackupports: enp0s3 link watches: link summary: up instance [link _ watch_0]: name: ethtool link: up down count: 0 enp0s8 link watches: link summary: up instance [link _ watch_0]: name: ethtool link: up down count: 0runner: active port: enp0s8

Now the active port is enp0s8. Let's disconnect this port to see if the active / standby mode configuration is working:

[root@localhost ~] # nmcli device disconnect enp0s8 Device 'enp0s8' successfully disconnected. [root@localhost ~] # teamdctl team0 statesetup: runner: activebackupports: enp0s3 link watches: link summary: up instance [link _ watch_0]: name: ethtool link: up down count: 0runner: active port: enp0s3

See that the active interface is switched to enp0s3.

Summary

Link aggregation in active and standby mode places one of the interfaces in a backup state and makes it active only if the active interface is disconnected.

Original address: https://www.linuxprobe.com/nmcli-team-port.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report