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

How to bind multiple network cards in CentOS

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

How to bind multiple network cards in CentOS, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

High bandwidth

Redundancy / elasticity

Now let's configure the network card binding on CentOS 7. We need to decide which interfaces to choose to configure as a group interface (Team interface).

Run the ip link command to view the interfaces available on the system.

$ip link

Here we use eno16777736 and eno33554960 network cards to create a group interface in "active backup" mode. (translator's note: for different modes, please refer to the principle of 7 bond modes of multiple network cards.)

Use the nmcli command to create a connection to the netgroup interface according to the following syntax.

The code is as follows:

# nmcli con add type team con-name CNAME ifname INAME [config JSON]

CNAME refers to the name of the connection, INAME is the name of the interface, and JSON (JavaScript Object Notation) specifies the processor (runner) used. The format of the JSON syntax is as follows:

The code is as follows:

'{"runner": {"name": "METHOD"}'

METHOD is one of the following: broadcast, activebackup, roundrobin, loadbalance, or lacp.

1. Create a group interface

Now let's create a group interface. This is the command we used to create the group interface.

The code is as follows:

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

Run the # nmcli con show command to verify the group interface configuration.

The code is as follows:

# nmcli con show

two。 Add slave Devic

Now let's add the slave device to the master device team0. This is the syntax for adding a slave device:

The code is as follows:

# nmcli con add type team-slave con-name CNAME ifname INAME master TEAM

Here we add eno16777736 and eno33554960 as slaves to the team0 interface.

The code is as follows:

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

The code is as follows:

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

Verify the connection configuration again with the command # nmcli con show. Now we can see the slave device configuration information.

The code is as follows:

# nmcli con show

3. Assign IP addr

The above command creates the required configuration files in the / etc/sysconfig/network-scripts/ directory.

Now let's assign an IP address to the team0 interface and enable the connection. This is the command to make the IP allocation.

The code is as follows:

# nmcli con mod team0 ipv4.addresses "192.168.1.24Accord 24 192.168.1.1"

# nmcli con mod team0 ipv4.method manual

# nmcli con up team0

4. Verify binding

Use the # ip add show team0 command to verify the IP address information.

The code is as follows:

# ip add show team0

Now use the teamdctl command to check the active backup configuration functionality.

The code is as follows:

# teamdctl team0 state

Now let's disconnect the active port and check the status again to confirm that the active backup configuration is working as expected.

The code is as follows:

# nmcli dev dis eno33554960

After disconnecting the active port, check the status again with the command # teamdctl team0 state.

The code is as follows:

# teamdctl team0 state

Yes, it works well! We will use the following command to connect back to the disconnected team0.

The code is as follows:

# nmcli dev con eno33554960

We also have a teamnl command that displays some options for the teamnl command.

Check the port running on team0 with the following command.

The code is as follows:

# teamnl team0 ports

Displays the port on which team0 is currently active.

The code is as follows:

# teamnl team0 getoption activeport

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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