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

Example Analysis of nmcli Network Card binding and teaming configuration

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you the nmcli network card binding and teaming configuration example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

After RHEL7, the network has changed a lot, because all network services are managed by NetworkManager, while in version 6, NetworkManager is generally turned off, mainly because it is not mature enough. The following describes how to use the nmcli command to manage and configure the network in rhel7 and centos7.

Rhel7 uses ip link instead of the ifconfig command, uses teamd to handle dual Nic aggregation, and uses the nmcli command line to configure the network.

The network connection created by nmcli is arbitrary, including bond, bridge, vlan, wifi, bluetooth, ethernet, * * and so on. There is an one-to-many relationship between devices and connections, but each device can only correspond to one initiated connection at a time.

General usage of nmcli:

Nmcli dev status / / View the connection status of the existing network devices in the system

Nmcli conn show / / View existing connections

Nmcli conn delete UUID1 UUID2 UUID3 / / Delete unwanted connections

Nmcli dev connect eno16777736 / / connect the device eno16777736, which is similar to connecting the network cable of the network card

Nmcli dev disconnect eno16777736 / / disconnect the device eno16777736, similar to unplugging the network cable

Nmcli conn down eno16777736 / / close connection eno16777736

Nmcli conn up eno16777736 / / Open connection eno16777736

Nmcli dev show / / View device details

Create, name connections, and do basic configuration

Nmcli conn add type ethernet con-name ens160 ifname ens160// creates a new connection con-name is ens160 You can also change eth0.nmcli conn mod ens160 ipv4.method manual / / to configure IP address acquisition method according to your personal habits: manual nmcli conn mod ens160 ipv4.addresses "10.x.x.x/24" / / configure IP and mask nmcli conn mod ens160 ipv4.gateway "10.x.x.254" / / configure gateway nmcli conn mod ens160 ipv4.dns "x.x.x.x" / / configure dnsnmcli conn mod ens160 connection.autoconnect yes / / Configure nmcli conn up ens160 / / Boot Network Card to boot automatically

Configure the network card bond

1. Create a primary interface

Nmcli con add type bond con-name bond0 ifname bond0 mode active-backup

two。 Assign ip addresses to the primary interfac

Nmcli con mod bond0 ipv4.addresses' 11.16.25.100 Compact 24'

Nmcli con mod bond0 ipv4.method manual

Nmcli con mod bond0 connection.autoconnect yes

3. Create a slave interface

Nmcli con add type bond-slave ifname eno1 master bond0

Nmcli con add type bond-slave ifname eno2 master bond0

4. Turn on the master and slave interfaces

Nmcli con up bond-slave-eno2

Nmcli con up bond-slave-eno1

Nmcli con up bond0

Nic teaming configuration

# nmcli con add type team con-name team0 ifname team0 config'{"runner": {"name": "activebackup"}'

# nmcli con mod team0 ipv4.addresses' 192.168.0.100Universe 24'

# nmcli con mod team0 ipv4.method manual

# nmcli con add type team-slave con-name team0-port1 ifname eno1 master team0

# nmcli con add type team-slave con-name team0-port2 ifname eno2 master team0

# teamdctl team0 state (View status)

Linux Nic aggregation generally has the following modes

Broadcast transmits packets from all ports

Roundrobin transmits packets on all ports in a round-robin manner

Activebakup this is a failover program that monitors link changes and selects active ports for transmission

Loadbalance monitors traffic and uses hash functions to try to achieve perfect balance when choosing a transport port

Lacp implements the 802.3ad link aggregation protocol, which can use the same transport port as the loadbalance runner

If lacp mode is used for aggregation, there will be problems with PXE installation in the network, because PXE will only initialize a network card to DHCP the application address. It is obviously not appropriate to modify the switch configuration in this process, and you can only choose dynamic aggregation. Note that lacp mode requires access switch support.

The above is all the contents of the article "sample Analysis of nmcli Network Card binding and teaming configuration". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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: 252

*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