Linux set NIC aliases and Nic Bindings

Source: Internet
Author: User

Nic Aliases | CentOS 6 Bonding | CentOS 7 NMCLI Network Group



Nic Aliases:

1. Command implementation: all for temporary effect

Ifconfig

]# ifconfig eth0:0 202.204.235.5, 24
]# ifconfig eth0:0 down to revoke the alias


Ip:

]# IP addr Add 202.204.235.10/24 dev eth0

The address is not visible to the ifconfig command

]# IP addr Add 202.204.235.20/24 dev eth0 label eth0:0

Ifconfig Displays the label information, and if you add an address to the alias, Ifconfig only shows the primary address.

]# ip addr del 202.204.235.20/24 dev eth0 remove address]# IP addr Flush dev eth0 label eth0:0 Empty the address of eth0:0


2. configuration file Implementation Restart service permanently and effectively shuts down the NetworkManager service

Create a provisioning file under/etc/sysconfig/network-scripts/

]# VI ifcfg-eth#:#

device=eth#:#

ipaddr=202.204.235.5

netmask=255.255.0.0

Onparent=yes


eth#:# NIC Alias name example Eth0:1

Restart Service effective: Services Network restart



Bonding: Multiple network adapters bind the same IP address fault tolerance

1. New Ifcfg-bond0

Device=bond0

ipaddr=10.1.20.20

Prefix=16

bonding_opts= "Miimon=100 mode=1"


# # MIIMON=100 detected once per 100ms

Mod:0 1 3

Mode 0 (BALANCE-RR)

Rotation (Round-robin) Policy:

Sequentially sends a packet over each of the slave interfaces. Ability to provide load balancing and fault tolerance

Mode 1 (active-backup)

Active-Backup (master and Standby) policy:

Only one slave is activated. Other slave are activated only if the active slave interface fails.

To prevent the switch from confusing, the bound MAC address is visible on only one external port

Mode 3 (broadcast)

Broadcast policy:

All messages are transmitted on all slave interfaces. This mode provides fault-tolerant capability.

2. Change Ifcfg-eth0 ifcfg-eth1.

Device=eth0

*Master=bond0

*Slave=yes

Modprobe bonding Loading bonding module

View bond0 Status:/proc/net/bonding/bond

Test

Close Bond

Ifdown bond0 shut down the device

Rmmod bonding removal of bond modules



CentOS 7 NMCLI implements multiple NIC bindings: NetworkManager Command line tool

# NMCLI

Multiple NIC bindings:

1. Create a group interface:

]# NMCLI c A type team con-name TEAM0 ifname team0 config ' {"runner": {"name": "Activebackup"}} '

"Activebackup" is the primary standby policy, no need to configure the switch

2. Add from Device:

]# nmcli c A type team-slave con-name TEAM0-PORT1 ifname eno16777736 master team0]# nmcli c a type Team-slave Con-name tea M0-PORT2 ifname eno33554984 Master Team0


3. Assigning IP addresses:

]# nmcli con mod team0 ipv4.addresses "10.1.23.23/16"]# nmcli con mod team0 ipv4.method manual change to manually set]# nmcli con up te Am0 Startup group team0]# nmcli con up team0-port1]# nmcli con up team0-port2


The above command generates a configuration file:

/Etc/sysconfig/network-scripts/ifcfg-team0

Device=team0

team_config= "{\" Runner\ ": {\" name\ ": \" Activebackup\ "}}"

Devicetype=team

Bootproto=none

Name=team0

Uuid=fda04197-00a1-4961-a2d3-ea311ef13aab

Onboot=no

ipaddr=10.1.23.23

Prefix=16

/etc/sysconfig/network-scripts/ifcfg-team0-port{1,2}

Name=team0-port1

Uuid=c71297ab-eed9-474e-bff3-5557d4fb8ba8

device=eno16777736

Onboot=yes

Team_master=team0

Devicetype=teamport


Test:

Teamdctl team0 State View group status

nmcli Dev dis eno16777736 disable NIC





This article is from the "mediocre" blog, please be sure to keep this source http://zzjasper.blog.51cto.com/9781564/1850605

Linux set NIC aliases and Nic Bindings

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.