Bind multiple NICs using nmcli commands in Linux

Source: Internet
Author: User

Bind multiple NICs using nmcli commands in Linux

Today, let's take a look at how to bind a NIC with nmcli (Network Manager Command Line Interface: Network Management Command Line Interface) in CentOS 7.x.

Nic (Interface) binding is a way to logically connect multiple NICs to allow failover or improve throughput. One way to improve server network availability is to use multiple NICs. Linux driver binding provides a way to aggregate multiple NICs into a logical binding interface. This is a new method for implementing binding, and does not affect the old binding driver in the linux kernel.

Nic binding provides two main benefits:

  1. High bandwidth
  2. Redundancy/Elasticity

Now let's configure Nic binding on CentOS 7. We need to decide which interfaces to configure as a Team interface ).

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

  1. $ ip link

Here we use eno16777736 and eno33554960 NICs to create a group interface in active backup mode. (Note: For details about different modes, refer to seven bond modes of multiple NICs)

Use the nmcli command to create a connection for the Network Group interface according to the following syntax.

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

CNAME indicates the connection name. INAME is the interface name. JSON (JavaScript Object Notation) specifies the runner used ). The JSON syntax format is as follows:

  1. '{"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 used to create a group interface.

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

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

  1. # nmcli con show

 

2. Add a Slave Device

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

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

Here we add eno16777736 and eno33554960 as the slave device of the team0 interface.

  1. # nmcli con add type team-slave con-name team0-port1 ifname eno16777736 master team0
  2. # nmcli con add type team-slave con-name team0-port2 ifname eno33554960 master team0

Run the # nmcli con show command again to verify the connection configuration. Now we can see the device configuration information.

  1. #nmcli con show

 

3. assign an IP address

The above command will create the required configuration file in the/etc/sysconfig/network-scripts/directory.

Now let's assign an IP address for the team0 interface and enable this connection. This is the command for IP Address allocation.

  1. # nmcli con mod team0 ipv4.addresses "192.168.1.24/24 192.168.1.1"
  2. # nmcli con mod team0 ipv4.method manual
  3. # nmcli con up team0

 

4. Verify binding

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

  1. #ip add show team0

Now, use the teamdctl command to check the active backup configuration function.

  1. # teamdctl team0 state

Now let's disconnect the activated port and check the status again to check whether the active backup configuration works as expected.

  1. # nmcli dev dis eno33554960

Disconnect the activation port and run the command # teamdctl team0 state again to check the status.

  1. # teamdctl team0 state

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

  1. #nmcli dev con eno33554960

We also have a teamnl command to display some options of the teamnl command.

Run the following command to check the port running on team0.

  1. # teamnl team0 ports

Display the active port of team0.

  1. # teamnl team0 getoption activeport

Okay, we have successfully configured the NIC binding :-). If you have any feedback, please let us know.

How to Implement Dual IP addresses for a single Nic In Ubuntu

Assign multiple IP addresses to a network card on CentOS 7

Linux dual-nic binding practices

CentOS/Linux dual-nic is bound to a single IP address, and nic hot standby

Bind a single IP address to a dual-nic in Linux [CentOS]

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.