Ubuntu dual NIC Preparation configuration

Source: Internet
Author: User

Recently there is a demand, the switch has two, do a stack, the server dual network card, each connected to a switch. This requires the server's network card into the main standby mode to increase security, so that when one of the switches is not available, the network card can automatically switch.

The overall configuration is not difficult, there are corresponding tutorials on the Internet, there may be some version of Ubuntu is different, so the configuration is not achieved due to the effect, and finally through the 51 operation and maintenance network of Ubuntu dual-Nic binding Setup method of the method to achieve this function, this article simple record.

First, the working mode of bond

The Linux bonding driver provides a bundle of multiple network interface devices into a single network interface setting for Network Load Balancing and network redundancy.

Bonding there are altogether 7 modes of operation:

0: (BALANCE-RR) round-robin policy: (Balanced polling 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: (Active 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: (Balanced strategy): transmits a transmission device based on a Boolean value [(Source MAC address Xor destination MAC address) mod device number]. This mode provides load balancing and fault tolerance.

3: (broadcast) broadcast policy: (Broadcast policy): Transfers all packets to all devices. 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. This mode provides fault tolerance. Each device requires drive-based re-acquisition speed and full-duplex support, and if the switch is used, the switch also needs to enable 802.3AD mode.

5: (balance-tlb) Adaptive Transmit load balancing (adapter transport load balancer): Channel bindings do not require dedicated switch support. The traffic emitted is assigned to each device according to the current load. Received by the current device, if the accepted device does not pass, use another device to take over the MAC address that the current device is processing.

6: (BALANCE-ALB) Adaptive load Balancing: (Adapter Load Balancer): Includes MODE5, the payload that is received by the ARP negotiation. The bonding driver intercepts the request sent by ARP on the local system, overwriting the original address of the subordinate device with one of the hardware addresses. It's like a different person on the server using a different hardware address.

The requirements of this article are as described in Pattern 1, which is the main standby mode.

II. Configuration Step 2.1 determine the NIC name

First determine the name of the two network card, generally eth0, eth1, if you have added the name of the network card may be different, in the installation of the system can be seen, through the ipmaddr command to view all network card information.

2.2 Installing Ifenslave Software

The Ifenslave is a bonded and decoupled software that efficiently distributes packets to the bonding driver.

sudo apt-get install ifenslave
2.3 Modify/etc/modules File

Add in/etc/modules:

mode=1 miimon=100

Note that is added, do not delete other content. Mode=1 is using mode 1, and of course you can use other modes.

The Miimon is used for link monitoring. For example, miimon=100, the system is monitored every 100ms link connection status, if one line is not available to switch another line.

2.4 Modify/etc/network/interfaces File

Add in/etc/network/interfaces:

AutoBond0IfaceBond0inetStaticAddress 10.128.1netmask 255.255 .255.0 Gateway 10.128.1 .200post-up  Ifenslave bond0 eth0 eth1pre-down  Ifenslave -d bond0 eth0 eth1       
2.5 Restarting the server

Due to the loading module, reboot is required. After restarting, you can see how the BOND0 works with the following commands.

/proc/net/bonding/bond0

This file is a working state of bond0. You can also check the operating status of the NIC via Ifconfig.

Note that bonding can only provide link monitoring, i.e. whether the link from the host to the switch is connected. If only the link of the switch to external (such as firewall, etc.) is down, and the switch itself does not fail, then bonding will assume that the link is not a problem and continue to use.

Iii. Summary

This paper simply records the details and considerations of the configuration of the main standby mode of the ubuntu14.04 dual NIC, the other versions may be slightly different and pay attention to practice. Does the network need to be master, do you have a master backup of your life, and can you switch when this work cannot continue?

Ubuntu dual NIC Preparation configuration

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.