How to bind an IP address to a Linux dual NIC (1)

Source: Internet
Author: User

Bind an IP address to a Linux dual-nic. The actual task is to use two NICs as one. Using the same IP address is a better and faster service. Here we use RHLE3 to experiment on this job. Bind an IP address to a Linux dual-nic. Here we will introduce the specific practices. The following section describes some problems.

NIC) The binding technology helps to ensure high availability and provide other advantages to improve network performance. The implementation of dual NIC binding in Linux described here is to use two NICs to virtualize one NIC, the aggregated device seems to be a separate Ethernet interface device. Generally speaking, two NICs have the same IP address and the parallel links are aggregated into a logical link. In fact, this technology already exists in Sun and Cisco, known as Trunking and Etherchannel technology. It is also used in Linux 2.4.x kernel, known as bonding. The earliest application of bonding technology was on the cluster beowulf, designed to improve data transmission between cluster nodes. Next we will discuss the principles of bonding. What is bonding? It should start with the promisc mode of the NIC. We know that, under normal circumstances, the network adapter only receives the target hardware Address (MAC Address) as its own Mac Ethernet frame, and filters out all other data frames to reduce the burden on the driver. However, the NIC also supports another promisc mode, which can be used to receive all frames on the network. For example, tcpdump runs in this mode. Bonding also runs in this mode, and modifies the mac address in the driver, changing the Mac address of the two NICs to the same, can receive data frames of a specific mac. Then, the data frame is sent to the bond driver for processing.
After talking about the theory for half a day, the configuration is actually very simple. There are four steps in total:

The operating system of the experiment is Redhat Linux Enterprise 3.0.

Prerequisites: the chipset model is the same, and the NIC should have its own independent BIOS chip.

1. New/etc/sysconfig/network-scripts/ifcfg-bond0 File

DEVICE = bond0

ONBOOT = yes

BOOTPROTO = static

IPADDR = 192.168.0.23

NETMASK = zookeeper

GATEWAY = 192.168.128.233

USERCTL = no

Do not specify the IP address, subnet mask, or Nic ID of a single Nic. Specify the above information to the virtual adapter (bonding.

2. Change/etc/sysconfig/network-scripts/ifcfg-eth0 Nic Properties

DEVICE = eth0

ONBOOT = yes

BOOTPROTO = none

MASTER = bond0

USERCTL = no

3. Change the properties of the/etc/sysconfig/network-scripts/ifcfg-eth1 Nic

DEVICE = eth1

ONBOOT = yes

BOOTPROTO = none

MASTER = bond0

USERCTL = no

Source: DIY tribe

4 # vi/etc/modules. conf

Edit the/etc/modules. conf file and add the following line to enable the system to load the bonding module at startup. The external virtual network interface device is bond0.

Add the following two rows

Alias bond0 bonding

Options bond0 miimon = 100 mode = 1

Note: miimon is used for link monitoring. For example: miimon = 100, The system monitors the link connection status every Ms. If one line fails, it is transferred to another line. The value of mode indicates the working mode, which has a total, two or three modes, commonly used: 0, 1.

Mode = 0 indicates that the load balancing (round-robin) method is load balancing, and both NICs work.

Mode = 1 indicates that fault-tolerance (active-backup) provides redundancy, working in the active/standby mode. That is to say, by default, only one network card works and the other is used for backup.

Bonding can only provide link monitoring, that is, whether the link from the host to the switch is connected. If the external link of the switch is down and the switch is not faulty, bonding considers that the link is correct and continues to be used.

5 # vi/etc/rc. d/rc. local

Add two rows

Ifenslave bond0 eth0 eth1

Route add-net 172.31.3.254 netmask limit 255.255.0 bond0

6. After the configuration is complete, restart the machine.

The following information is displayed after restart, indicating that the configuration is successful.

................

Bringing up interface bond0 OK

Bringing up interface eth0 OK

Bringing up interface eth1 OK

In this way, you can bind an IP address to a Linux dual-nic. The following article will describe this issue in detail.

  1. Differences between Linux and Unix
  2. Detailed analysis of Linux folder execution Permissions
  3. How to check Linux Security Vulnerabilities
  4. Linux bash shortcut keys
  5. Detailed analysis of Linux Server Memory

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.