CentOS/Linux dual-nic is bound to a single IP address, and nic hot standby
With the development of technology, four Gigabit Ethernet NICs have become the standard for servers. In the production environment, to ensure the network stability of the CentOS/Linux server, two NICs of the server are bound with an IP address to implement hot backup of the NIC. The procedure is as follows:
1: Create and configure the modprobe. conf file
# Vi/etc/modprobe. conf
Alias bond0 bonding
Options bond0 miimon = 100 mode = 1
# Note
<1> millmon indicates the link monitoring interval. The unit is ms. millmon = 100 indicates that the link connection status is monitored every ms. If one connection fails, it is transferred to another one. This value is recommended to be 100. Setting it to another value may cause instability.
<2>: mode indicates the running mode of two NICs, 0 indicates load blance, and 1 indicates Hot Backup (hot backup is recommended)
2: Create the bond0 STARTUP configuration file:
# Cd/etc/sysconfig/network-scripts/
# Vi ifcfg-bond0
DEVICE = bond0
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.100.12
NETMASK = 255.255.255.0
USERCTL = no
3: Edit Nic profile ifcfg-eth0, ifcfg-eth1
3.1: Configure Nic 1
# Vi ifcfg-eth0
DEVICE = eth0
USERCTL = no
ONBOOT = yes
MASTER = bond0
SLAVE = yes
BOOTPROTO = none
3.2: Configure Nic 2
# Vi ifcfg-eth1
DEVICE = eth1
USERCTL = no
ONBOOT = yes
MASTER = bond0
SLAVE = yes
BOOTPROTO = none
# Note: MASTER = bond0 and SLAVE = yes are mainly used for automatic enabling after System service network restart.
4: Set startup
# Echo "ifenslave bond0 eth0 eth1">/etc/rc. d/rc. local
After the configuration is complete, restart the network service or the server, as shown below:
# Service network restart or # init 6
5: View and Test
5.1: View bond0 Information
# Cat/proc/net/bonding/bond0
5.2: Test
Ping the IP address, and then unplug the two network cables of the server to check whether packet loss occurs.
Bind a single IP address to a dual-nic in Linux [CentOS]