Linux under dual NIC binding bond0

Source: Internet
Author: User

A: Principle:

There are seven modes for dual NIC bindings under Linux operating system. Now the general enterprise will use dual-card access, so that both the network bandwidth can be added, while the corresponding redundancy can be said to be a lot of benefits. And the general enterprise will use the Linux operating system comes with the network card binding mode, of course, now the network card manufacturers will also be some for the Windows operating system network card management software to do network card binding (Windows operating system does not have a network card binding feature requires third-party support).

To get to the point, Linux has seven types of NIC bindings:

0. Round robin;

1.active-backup;

2.load balancing (XOR);

3.fault-tolerance (broadcast);

4.LACP;

5.transmit load Balancing;

6.adaptive load Balancing.

Second, test one: Redhat5 (mode=1 (active-backup): A network card is active, one is in a backup state, all traffic is processed on the main link. When the active NIC is down, the network card that is backed up is enabled. )

1. Edit the/etc/sysconfig/network-scripts/ifcfg-bond0 file and enter the following command:

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

Device=bond0

Bootproto=none

Obboot=yes

ipaddr=192.168.100.126

netmask=255.255.255.0

Type=ethernet

Userctl=no

bonding_opts= "Mode=1 miimon=100"

Indicates that the system loads the bonding module at startup, and the external virtual network interface device is bond0;miimon=100 that the system monitors the link connection status every 100ms, and if one line is not connected, it is transferred to another line; Mode=1 represents Fault-tolerance ( Active-backup) provides redundancy, working in a way that the master works, which means that only one NIC works by default, and the other is backed up.

2, edit the/etc/sysconfig/network-scripts/ifcfg-eth0 file, enter the following content:

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

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

Device=eth0

Bootproto=none

Onboot=yes

Userctl=no

Master=bond0

Slave=yes

3, edit the/etc/sysconfig/network-scripts/ifcfg-eth1 file, enter the following content:

[Email protected] ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth1

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

Device=eth1

Bootproto=none

Onboot=yes

Userctl=no

Master=bond0

Slave=yes

4. Execute the following command:

[[email protected] ~]# echo "Alias bond0 bonding" >>/etc/modprobe.conf

5. Effective BOND0

[Email protected] ~]# modprobe bonding

Third, test two: Redhat6 (mode=1 (active-backup): A network card is active, one is in a backup state, all traffic is processed on the main link. When the active NIC is down, the network card that is backed up is enabled. )

1. Edit the/etc/sysconfig/network-scripts/ifcfg-bond0 file and enter the following:

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

Device=bond0

Bootproto=static

Onboot=yes

ipaddr=192.168.100.116

netmask=255.255.255.0

gateway=192.168.100.1

Type=ethernet

Userctl=no

bonding_opts= "mode=1 miimon=100 primary=eth0"

2. Edit the/etc/sysconfig/network-scripts/ifcfg-eth0 file and enter the following:

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

Device=eth0

Onboot=yes

Bootproto=none

Userctl=no

Master=bond0

Slave=yes

3, edit the/etc/sysconfig/network-scripts/ifcfg-eth1 file, enter the following content

[Email protected] ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth1

Device=eth1

Onboot=yes

Bootproto=none

Userctl=no

Master=bond0

Slave=yes

4. Execute the following statement:

[[email protected] ~]# #echo "Alias bond0 bonding" >>/etc/modprobe.d/dist.conf

[Email protected] ~]# #echo "Options bond0 miimon=100 mode=0" >>/etc/modprobe.d/dist.conf

Description
The Miimon is used for link monitoring. For example: miimon=100, then the system every 100MS monitoring link connection status, if one line is not connected to another line;
The value of mode indicates the mode of operation, he has a total of 0,1,2,3 four modes, commonly used for 0, 12 kinds. Depending on the mode of operation available to the switch.
Mode=0 means that loadbalancing (round-robin) is load balanced and both NICs work.
Mode=1 indicates that fault-tolerance (active-backup) provides redundancy, working in a way that the primary and standby means that only one NIC works by default, and the other is backed up.
Note
A, bonding can only provide link monitoring, that is, the link from the host to the switch is connected. If only the switch's external link is down, and the switch itself does not fail, then bonding will assume that the link is not a problem and continue to use it.
b, set the mode to be consistent with the mode set by the switch.

5. Close NetworkManager Service:

[[Email protected] ~]# service NetworkManager status

NetworkManager is stopped

[Email protected] ~]# Chkconfig NetworkManager off

[Email protected] ~]#

6. Restart the computer:

[Email protected] ~]# #init 6

7. Ifconfig View IP:

[Email protected] ~]# ifconfig

Bond0 Link encap:ethernet HWaddr 00:50:56:80:2c:53

inet addr:192.168.100.116 bcast:192.168.100.255 mask:255.255.255.0

Inet6 ADDR:FE80::250:56FF:FE80:2C53/64 Scope:link

Up broadcast RUNNING MASTER multicast mtu:1500 metric:1

RX packets:1741 errors:0 dropped:0 overruns:0 frame:0

TX packets:332 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:137206 (133.9 KiB) TX bytes:38181 (37.2 KiB)

Eth0 Link encap:ethernet HWaddr 00:50:56:80:2c:53

Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1

RX packets:888 errors:0 dropped:0 overruns:0 frame:0

TX packets:332 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:69751 (68.1 KiB) TX bytes:38181 (37.2 KiB)

eth1 Link encap:ethernet HWaddr 00:50:56:80:2c:53

Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1

RX packets:853 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:67455 (65.8 KiB) TX bytes:0 (0.0 b)

Lo Link encap:local Loopback

inet addr:127.0.0.1 mask:255.0.0.0

Inet6 addr::: 1/128 scope:host

Up LOOPBACK RUNNING mtu:16436 metric:1

RX packets:24827 errors:0 dropped:0 overruns:0 frame:0

TX packets:24827 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:7421150 (7.0 MiB) TX bytes:7421150 (7.0 MiB)

Virbr0 Link encap:ethernet HWaddr 52:54:00:82:5f:52

inet addr:192.168.122.1 bcast:192.168.122.255 mask:255.255.255.0

Up broadcast RUNNING multicast mtu:1500 metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0  (0.0 b) TX bytes:0 (0.0 b)

[Email protected] ~]#

8. View configuration information

[Email protected] ~]# cat/proc/net/bonding/bond0

Ethernet Channel Bonding driver:v3.6.0 (September 26, 2009)

Bonding mode:fault-tolerance (Active-backup)

Primary Slave:eth0 (Primary_reselect always)

Currently Active Slave:eth0

MII Status:up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface:eth0

MII Status:up

speed:10000 Mbps

Duplex:full

Link Failure count:1

Permanent HW addr:00:50:56:80:2c:53

Slave Queue id:0

Slave interface:eth1

MII Status:up

speed:10000 Mbps

Duplex:full

Link Failure count:1

Permanent HW addr:00:50:56:80:4c:54

Slave Queue id:0

Linux under dual NIC binding bond0

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.