Bond dual NIC Binding

Source: Internet
Author: User

Description: Two network card is made into a virtual network card, a bad after not affect the business

1.

Two NIC Eth0

Eth1

Note: No eth1 words to add a network card, cloned virtual confidential configuration is good

2.bond Host Bond0

3. First step: Configure settings file [[email protected] network-scripts]# vim/etc/sysconfig/network-scripts/ Ifcfg-bond0

Content:

[email protected] ~]# cat/etc/sysconfig/network-scripts/ifcfg-bond0

Device=bond0

Type=ethernet

Onboot=yes

Nm_controlled=yes

Bootproto=static

ipaddr=192.168.33.128

netmask=255.255.25.0

gateway=192.168.33.2

dns1=192.168.33.2

dns2=8.8.8.8

broadcast=192.168.33.255

Userctl=no

[email protected] ~]#

4. Step two: Edit the eth0 nic

[email protected] network-scripts]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0

Bootproto=none

Master=bond0

Slave=yes

[email protected] network-scripts]#

5. Edit the Eth1 NIC

[email protected] network-scripts]# vim/etc/sysconfig/network-scripts/ifcfg-eth1

Device=eth1

Bootproto=none

Master=bond0

Slave=yes

6. because the Linux virtual network card is implemented in the kernel module, it needs to be installed when the module is loaded. Add the following in the /etc/modules.conf file (if there is no file, create a new one):

[email protected] ~]# cat/etc/modules.conf

Alias Bond0 Bonding

Options Bond0 miimon=100 mode=1 primary=eth0

[email protected] ~]#

7 Configuration of the boot configuration document

[email protected] ~]# tail-n 1/etc/rc.local

Modprobe Bonding miimon=100 mode=1

[email protected] ~]#

8. Restart the network to confirm bond status

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/5D/wKioL1ccKHTCRtZpAAAesG61OUw414.png "title=" Clipboard.png "alt=" Wkiol1cckhtcrtzpaaaesg61ouw414.png "/>

② View bond status start

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s5.51cto.com/wyfs02/m02/7f/5f/wkiom1ccj8xtqzreaaarqbtoyfo258.png "title=" Clipboard.png "alt=" Wkiom1ccj8xtqzreaaarqbtoyfo258.png "/>

9. Check the status

[email protected] ~]# ifconfig | grep HWaddr

Bond0 Link encap:ethernet HWaddr 00:0c:29:07:7e:b1

Eth0 Link encap:ethernet HWaddr 00:0c:29:07:7e:b1

eth1 Link encap:ethernet HWaddr 00:0c:29:07:7e:b1

[email protected] ~]#

10. The system automatically binds, sets the default gateway

[email protected] ~]# echo "Ifenslave bond0 eth0 eth1" >>/etc/rc.d/rc.local

[email protected] ~]# echo "route add default GW 192.168.33.2" >>/etc/rc.d/rc.local

[email protected] ~]#

11. Restart Effective

[[email protected] ~]# Ping www.baidu.com

PING www.baidu.com (119.75.218.70) bytes of data.

Bytes from 119.75.218.70:icmp_seq=1 ttl=128 time=4.80 ms

Bytes from 119.75.218.70:icmp_seq=2 ttl=128 time=4.48 ms

Bytes from 119.75.218.70:icmp_seq=3 ttl=128 time=8.40 ms

^c

---www.baidu.com ping statistics---

3 Packets transmitted, 3 received, 0% packet loss, time 2063MS

RTT Min/avg/max/mdev = 4.484/5.899/8.409/1.779 ms

[email protected] ~]#

12. Test:

(Clone session)

Last Login:mon April 21:26:23 from 192.168.33.1

[email protected] ~]# ifdown eth0

[email protected] ~]#

[email protected] ~]#

Test

[[email protected] ~]# Ping www.baidu.com

PING www.a.shifen.com (220.181.111.188) bytes of data.

Bytes from 220.181.111.188:icmp_seq=1 ttl=128 time=10.3 ms

Bytes from 220.181.111.188:icmp_seq=2 ttl=128 time=5.30 ms

Bytes from 220.181.111.188:icmp_seq=3 ttl=128 time=8.88 ms

Bytes from 220.181.111.188:icmp_seq=4 ttl=128 time=5.94 ms

Bytes from 220.181.111.188:icmp_seq=5 ttl=128 time=16.7 ms

Bytes from 220.181.111.188:icmp_seq=6 ttl=128 time=5.97 ms

Bytes from 220.181.111.188:icmp_seq=7 ttl=128 time=35.3 ms

Bytes from 220.181.111.188:icmp_seq=8 ttl=128 time=5.69 ms

Bytes from 220.181.111.188:icmp_seq=9 ttl=128 time=16.1 ms

***********************************************************************************

Where miimon=100 means check the link connection status every 100ms, if the general switch physical network card
Mode=1 represents the primary standby mode, which means that only one NIC is active and only provides fail-safe. If the mode=0 is in load-balanced mode, all network cards are active, and some other patterns are seldom used
Primary=eth0 indicates that eth0 is the default active NIC in primary and Standby mode

Miimon is the number of milliseconds that trigger an event that detects line stability every 100 milliseconds.
mode is the working state of Ifenslave.
there are altogether 7 ways:
= 0: (BALANCE-RR) round-robin policy: (Balanced whirl cycle strategy): The transmit packet order is transmitted sequentially until the last transmission is complete, which provides load balancing and fault tolerance.
= 1: (active-backup) active-backup policy: (Primary-backup policy): Only one device is active. One goes down and the other immediately transforms the primary device from the backup. The MAC address is externally visible. This mode provides fault tolerance.
= 2: (balance-xor) XOR policy:(Balancing strategy): transmission selects the transmission device according to the original address Boolean value. This mode provides load balancing and fault tolerance.  
= 3: (broadcast) broadcast policy: (Broadcast policy): Transfers all packets to all interfaces. This mode provides fault tolerance.   
= 4: (802.3AD) IEEE 802.3ad Dynamic link aggregation. IEEE 802.3ad Dynamic Link aggregation: Create an aggregation group that shares the same speed and duplex settings. (I don't really understand.) )
= 5: (balance-tlb) Adaptive Transmit load balancing (adapter transport load Balancer): There is no special policy, the first device can not pass through the first device to take over the MAC address that is being processed, help on a pass.
=6: (balance-alb) Adaptive load Balancing: (Adapter transport load balancer): Roughly means including mode5,bonding driver intercepts requests sent by ARP on the local system, Overwrite the original address of the slave device with one of the hardware addresses. It's like a different person on the server using a different hardware address.



This article is from the "Linux" blog, so be sure to keep this source http://wsxxsl.blog.51cto.com/9085838/1767173

Bond dual NIC Binding

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.