Bind dual NICs in linux (active/standby)

Source: Internet
Author: User
Bind dual NICs in linux (Master/Slave)-Linux Enterprise Application-Linux server application information. For details, refer to the following section. In actual business production, to ensure service stability, the dual Nic of the server is bound with an IP address for hot backup.

1. edit the file:
# Vi/etc/modprobe. conf
Add:
Alias bond0 bonding
Options bond0 miimon = 100 mode = 1
(0 indicates load blance; 1 indicates hot backup. Note: millmon is used for link monitoring. millmon = 100 indicates that the link connection status is monitored every Ms. If one connection fails, we recommend that you set this value to 100 and set it to another value, which may cause instability)

2. Create the bond0 STARTUP configuration file:
Cd/etc/sysconfig/network-scripts/
Cp ifcfg-eth0 ifcfg-bond0
Vi ifcfg-bond0

The content is as follows:
DEVICE = bond0
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.0.12
NETMASK = 255.255.255.0
USERCTL = no

3. Edit the ifcfg-eth0, ifcfg-eth1 two Nic configuration files, the content is as follows:
# Vi ifcfg-eth0
DEVICE = eth0
USERCTL = no
ONBOOT = yes
MASTER = bond0 // these two rows are mainly used for System service network restart
SLAVE = yes // is automatically enabled later
BOOTPROTO = none
HWADDR = XXXXXXXXXXXXXX

# Cp ifcfg-eth0 ifcfg-eth1
# Vi ifcfg-eth1
DEVICE = eth1
USERCTL = no
ONBOOT = yes
MASTER = bond0 // these two rows are mainly used for System service network restart
SLAVE = yes // is automatically enabled later
BOOTPROTO = none
HWADDR = XXXXXXXXXXXXXX

4. Edit the Startup File
# Vi/etc/rc. d/rc. local
Add at the end:
Ifenslave bond0 eth0 eth1

So far, after the linux server is configured, restart (command: reboot) or restart the network service (command: service network restart) to see that bong0 is successfully activated.

You can ping this IP address all the time, plug and unplug the two network cables of the server, and check whether the packet is lost. Then, you can check whether your bond0 is in the active/standby mode.
Or cat/proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.1.2 (January 20,200 7)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (MS): 100
Up Delay (MS): 0
Down Delay (MS): 0

Slave Interface: eth0
MII Status: down
Link Failure Count: 0
Permanent HW addr: 00: 14: 5e: fc: 16: 78

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00: 14: 5e: fc: 16: 7a
Related Article

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.