Linux Dual NIC Bindings

Source: Internet
Author: User

1. Create a virtual NIC as a configuration file to bind the network port/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-BOND0

The configuration content is as follows:

#cat/etc/sysconfig/network-scripts/ifcfg-bond0

Device=bond0 #虚拟网卡名称

Type=ethernet

Onboot=yes

Bootproto=static

ipaddr=192.168.11.130 #IP地址

netmask=255.255.255.0 #子网掩码

gateway=192.168.11.2 #网关

dns1=223.5.5.5 #DNS地址

dns2=223.6.6.6

bonding_opts=miimon=100 mode=0

2, modify the/etc/sysconfig/network-scripts/ifcfg-eth0 configuration, the content is as follows:

Device=eth0

Type=ethernet

Onboot=yes

Bootproto=none

Master=bond0

Slave=yes

Modify the/etc/sysconfig/network-scripts/ifcfg-eth1 configuration with the following content:

Device=eth1

Type=ethernet

Onboot=yes

Bootproto=none

Master=bond0

Slave=yes

3, modify the/etc/modprobe.d/dist.conf, configure the binding model, the configuration file finally added the following content

#tail-2/etc/modprobe.d/dist.conf

Alias Bond0 Bonding

Options Bond0 miimon=100 mode=0

#选项 Miimon Specifies how long it takes to monitor the link, in Ms.

#选项 mode indicates the working mode of the binding port, there are 0-6 total 7 modes, which are commonly used in 0 and 1 modes,

Mode=0 represents the "Round-robin" policy, and the two cards work simultaneously in a load-balanced state.

The mode=1 represents the "active-backup" policy, and the backup status of the two cards is one with one standby.

Use/etc/init.d/network Restart to restart the network after the above configuration has been modified.

To prevent the server from restarting, add the following to the/etc/rc.local:

#echo "Ifenslave bond0 eth0 eth1" >>/etc/rc.local

Check if join is successful

#tail-1/etc/rc.local

Ifenslave bond0 eth0 eth1

4. Testing

After any piece of network card is Ifdown, it does not affect the normal communication of the server

Linux Dual 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.