CENTOS6 Environment NIC Aliases and bond details

Source: Internet
Author: User

One. Nic Aliases

1. Useful for Virtual Hosting

2. Multiple IP addresses can be tied to an NTC

Eth0:1

Eth0:2

Eth0:3

3.ifconfig command

Ifconfig eth0:0 192.168.1.100/24 up temporarily modifies the IP address and subnet mask of the NIC and fails after restarting the network service

4.ip command

IP addr Add 172.16.1.2/16 dev eth0

2. When configuring aliases, there will be an incompatibility with the NetworkManager service to do the following:

Temporary Shutdown NetworkManager Services: Service NetworkManager stop

Boot does not start NetworkManager service: Chkconfig NetworkManager off

3. Alias format: ifcfg-ethx;xxx

4. Alias card can only use static address:

device=eth0:0

ipaddr=10.10.10.10

netmask=255.0.0.0

Onparent=yes

5. Network Properties configuration of TUI (text user interface)

System-config-network-tui

Setup

Note: Restarting the Network service will take effect

6. Configure the host name of the current host

Temporary entry into force: hostname [HOST_NAME]

Global effect:/etc/syscondfig/network (CENTOS6 experiment)

Hostname=zhang

Executive hostname Zhang takes effect

7. NIC modifies name or attribute information

/etc/udev/rules.d/70-perisstent-net.rules

To uninstall the NIC driver:

Modprobe-r e1000

Installed on the NIC driver:

Modprobe e1000


The following is an alias for the CentOS 6 network adapter

1.CP Ifcfg-eth0 Ifcfg-eth0:10 set up a NIC alias Eth0:10

2.vim ifcfg-eth0:10 Modifying configuration files

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/86/E6/wKioL1fOY2bx4kjbAAAUHJq92zo030.png "title=" 1.PNG " alt= "Wkiol1foy2bx4kjbaaauhjq92zo030.png"/>

Modify device name, set to static IP

3. Close the NetworkManager service

Temporary Shutdown NetworkManager Services: Service NetworkManager stop

4. Restart the NIC

Service Network restart


Two. Network interface configuration-bolding (CENTOS6 environment)

is to bind multiple network cards to the same IP address to provide services, can achieve high availability or load balancing, directly to the two network card set the same IP address is not possible, through bloding, virtual piece of network card outside the age to provide connectivity, physical network card is modified to the same MAC address.

Three modes of operation in 1.Bonding

(1) Mode 0 (BALANCE-RR)

Rotation (round-robin) strategy: Send packets above and below each slave interface sequentially. This mode provides load balancing and fault tolerance (load balancing is the rotation of work, the first NIC is broken, the second block is normal, the network will be paralyzed; the first block is normal, the second block is broken, it works, But will lose the package)

(2) Mode 1 (active-backup)

Active-Backup (Master) policy: In the binding, only one slave is activated. The other slave is activated when and only if the active slave interface fails. To avoid a disruption to the switch, the MAC address of the binding is visible on only one external port (a NIC fails and the other is started)

(3) Mode 3 (broadcast)

Broadcast strategy: All messages are transmitted on all slave interfaces. This mode provides fault tolerance (NIC works at the same time, walk the same data)

Configuration of 2.Bonding

Vim/etc/sysconfig/network-scripts/ifcfg-bond0

Device=bond0

Bootproto=none

bonding_opts= "Miion=100 mode=0"


Vim/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0

Bootproto=none

Master=bond0

Slave=yes

Userctl=no

Vim/etc/sysconfig/network-scripts/ifcfg-eth1

Device=eth1

Bootproto=none

Master=bond0

Slave=yes

Userctl=no

In the above configuration file, Minion is used for link detection, if miion=100, then the system detects a link connection status every 100ms, if there is a line of memory transferred to another line

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

4. Delete Bonding

Step One (1) lsmod |grep bonding See if there is a bonding:

... (2) ifconfig bond0 down bonding

... (3) rmmodbonding Delete bonding

Delete bonding:rmmod Bonding

Example: The experiment on CENTOS6

Case one: mode=1, one network card is active and the other network card is in Backup state.

(1) Create a bonding configuration file, set as static IP

Vim/etc/sysconfig/network-scripts/ifcfg-bond0

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/86/E6/wKioL1fOY4CByxWxAAAf8Y2iqjo421.png "title=" 2. PNG "alt=" Wkiol1foy4cbyxwxaaaf8y2iqjo421.png "/>

(2) Modify the NIC configuration file eth0

Vim/etc/sysconfig/network-scripts/ifcfg-eth0

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/86/E7/wKiom1fOY5CyaCLTAAALBqv6YIY146.png "title=" 3. PNG "alt=" Wkiom1foy5cyacltaaalbqv6yiy146.png "/>


(3) Add a network card, you need to execute the command ifconfig eth1 up to start the network card, and in the/etc/sysconfig/network-scripts/directory to create the network card file Ifcfg-eth1

[email protected] network-scripts]# CP Ifcfg-eth0 IFCFG-ETH1

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/86/E6/wKioL1fOY7DwoQzxAAALfGXPbwA142.png "title=" 4. PNG "alt=" Wkiol1foy7dwoqzxaaalfgxpbwa142.png "/>


(4) Close the NetworkManager service and restart the network service

Service NetworkManager Restart

Service Network restart


(5) test

Both NICs are enabled and the network is OK

A. Disable the NIC Eth0

Ifconfig eth0 Down

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/86/E6/wKioL1fOY82AHbt8AAAlmiX-dPA191.png "title=" 5.PNG " alt= "Wkiol1foy82ahbt8aaalmix-dpa191.png"/>

Test Result: Network normal

B. Disable the NIC eth1 and enable the NIC Eth0

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/86/E7/wKiom1fOY-GhBcxnAAB5UWWPUqs752.png "style=" float: none; "title=" 6.PNG "alt=" Wkiom1foy-ghbcxnaab5uwwpuqs752.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/86/E6/wKioL1fOY-GAuLjfAAAXTHDY8SM330.png "style=" float: none; "title=" 7.png "alt=" Wkiol1foy-gauljfaaaxthdy8sm330.png "/>

...

Test Result: Network normal

Conclusion: mode=1 mode, provides fault tolerance, one NIC is damaged, another piece continues to work


Case two: Mode=0 is in load-balanced state, increasing bandwidth, fault tolerance

(1) Create Bond profile

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/86/E6/wKioL1fOZADT2CrQAAAuXjzBMgs063.png "title=" 8.PNG " alt= "Wkiol1fozadt2crqaaauxjzbmgs063.png"/>

(2) Modify the NIC configuration file eth0

Vim/etc/sysconfig/network-scripts/ifcfg-eth0

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/86/E6/wKioL1fOZAzR4wLWAAAMpRQql-8072.png "title=" 9.png " alt= "Wkiol1fozazr4wlwaaamprqql-8072.png"/>


(3) Add a network card, you need to execute the command ifconfig eth1 up to start the network card, and in the/etc/sysconfig/network-scripts/directory to create the network card file Ifcfg-eth1

[email protected] network-scripts]# CP Ifcfg-eth0 IFCFG-ETH1

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/86/E7/wKiom1fOZBnxxfvrAAAMlixzm1c544.png "title=" 10.png "alt=" Wkiom1fozbnxxfvraaamlixzm1c544.png "/>


(4) Close the NetworkManager service and restart the network service

Service NetworkManager Restart

Service Network restart


(5) test

Network is in a normal state when both NICs are started

A. First NIC eth0 disabled

Ifconfig eth0 Down

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/86/E7/wKiom1fOZCqDBSMPAAAN-a0pG3I966.png "title=" 11.png "alt=" Wkiom1fozcqdbsmpaaan-a0pg3i966.png "/>

...

Test Result: Network is not through,

B. Enable the first NIC Eth0, disable the second NIC Eth1

Ifconfig eth0 up;ifconfig eth1 down

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/86/E6/wKioL1fOZDWgTUAmAAAOou-JQvw146.png "title=" 12.png "alt=" Wkiol1fozdwgtuamaaaoou-jqvw146.png "/>

...

Test Result: Enable the first NIC Eth0, the network is OK, disable the second NIC, network or normal state

Conclusion: Mode=0 mode, mainly to achieve load balance, improve the loan, and the first NIC is damaged, the network will fail





This article from "zhang1003995416" blog, declined reprint!

CENTOS6 Environment NIC Aliases and bond details

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.