Linux Nic binding implementation

Source: Internet
Author: User
Authorization, allowingincreasedbandwidthandredundancyLet & 039; sassumewehavetwonetworkinterfaces (NIC channel bonding allows multiple network cards to act as one, allowing increased bandwidth and redundancy. let's assume we have two network interfaces ("eth0" and "eth1") and we want to bond them so they look like a single interface ("bond0 "). add the following Line to the "/etc/modprobe. conf "file. ============================ alias bond0 bonding ======== ============================== The files defining the regular and bonded interfaces are located in the "/etc/sysconfig/network -scripts "directory. create a new file called "ifcfg-bond0" for the bonded interface with the following contents (adjust the network parameters as applicable ). ====================================== === [Root @ rhel5 network-scripts] # cat ifcfg-bond0 # Intel Corporation 82540EM Gigabit Ethernet Controller DEVICE = bond0 BOOTPROTO = static ONBOOT = yes USERCTL = no IPADDR = 192.168.99.131 NETMASK = 255.255.255.0 BONDING_OPTS = "mode = 1 miimon = 100" ========================== instructions: 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 only the Switch's external link is down and the switch itself is not faulty, bonding considers the link to be okay and continues to use Amend the existing "ifcfg-eth0" and "ifcfg-eth1" files, adding the "MASTER" and "SLAVE" parameters. the contents of these files shoshould look like this. ============================ [root @ rhel5 network-scripts] # cat ifcfg-eth0 # Intel Corporation 82540EM Gigabit Ethernet Controller DEVICE = eth0 BOOTPROTO = none USERCTL = no ONBOOT = yes MASTER = bond0 SLAVE = yes [root @ rhel5 network-scripts] # cat ifcfg-eth1 # Intel Corporation 82540EM gigabit Ethernet Controller DEVICE = eth1 BOOTPROTO = none ONBOOT = yes USERCTL = none MASTER = bond0 SLAVE = yes ================ =========== Restart the network service. ===========================# service network restart ======== ============================ Once the bond is configured it acts like any other Ethernet device. for example, you can configure alias interfaces to handle multiple IP addresses, as shown below. create the "ifcfg-bond0: 1" and "ifcfg-bond0: 2" files in the "/etc/sysconfig/network-scripts" directory with the following contents. =============================# ifcfg-bond0: 1 file contents DEVICE = bond0: 1 BOOTPROTO = none ONBOOT = yes NETWORK = 192.168.0.0 NETMASK = 255.255.255.0 IPADDR = 192.168.0.172 USERCTL = no BONDING_OPTS = "mode = 1 miimon = 100" # ifcfg-bond0: 2 file contents DEVICE = bond0: 2 BOOTPROTO = none ONBOOT = yes NETWORK = 192.168.0.0 NETMASK = 255.255.255.0 IPADDR = 192.168.0.173 USERCTL = no BONDING_OPTS = "mode = 1 miimon = 100" ========== ======================= Restart the network service for the changes to take effect. you can view bond0's working Status query to learn the working status of bonding in detail [root @ redflag bonding] # cat/proc/net/bonding/bond0 bonding. c: v2.4.1 (September 15,200 3) Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (MS): 0 Up Delay (MS ): 0 Down Delay (MS): 0 Multicast Mode: all slaves Slave Interface: eth1 MII Status: up Link Failure Count: 0 Permanent HW addr: 00: 0e: 7f: 25: d9: 8a Slave Interface: eth0 MII Status: up Link Failure Count: 0 Permanent HW addr: 00: 0e: 7f: 25: d9: 8b
Related Article

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.