In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to achieve load balancing and failure protection through double Nic binding in Linux? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
In fact, in linux, the dual network card will be bound into a network card, the configuration is very simple, only a few simple steps can be achieved, let's try it together. First of all, let's give a brief introduction to the environment of this experiment:
Operating system: RedHat Enterprise linux 4.0
The prerequisite for binding: the chipset model is the same, and the network card should have its own independent BIOS chip.
Operation procedure:
1. Edit the virtual network interface configuration file and specify the network card IP (without this file we can copy one from the previous configuration file to reduce the amount of text entered.)
[root @ heng ~] # cp / etc/sysconfig/network-scripts/ifcfg-eth0 / etc/sysconfig/network-scripts/ifcfg-bond0
Make sure the content of / etc/sysconfig/network-scripts/ifcfg-bond0 is the same as the following
[root @ heng ~] # cat / etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.202
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
2. Edit / etc/sysconfig/network-scripts/ifcfg-eth0 and / etc/sysconfig/network-scripts/ifcfg-eth2 to ensure that the edited content is the same as that shown below.
[root @ heng ~] # cat / etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
[root @ heng ~] # cat / etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
# P#
3. Edit the / etc/moprobe.conf file and add the following line to make the system load the bonding module at startup, and the external virtual network interface device is bond0. Please make sure that the content displayed after editing the file is the same as the following
Description: miimon is used for link monitoring. For example: miimon=100, then the system monitors the link connection status every 100ms, and if one line fails, it will be transferred to another line; the value of mode indicates the working mode. There are four modes: 0meme, 1meme, 2meme, 3, and two are commonly used.
Mode=0 indicates that load balancing (round-robin) is a load balancing method, and both NICs work.
Mode=1 said that fault-tolerance (active-backup) provides redundancy and works in an active and standby mode, that is, by default, only one network card works and the other is backed up.
Bonding can only provide link monitoring, that is, whether the link from the host to the switch is connected. If only the external link down of the switch is down and the switch itself is not faulty, then bonding will continue to use the link because there is nothing wrong with it.
4. Edit / etc/rc.d/rc.local, and make sure that the content of the modified file is the same as the following
Here the configuration has been completed, restart the computer, and then use ifconfig to view the network card information, you will see that there is one more network card named bond0.
Let's discuss the following situations when mode is 0 and 1 respectively.
Mode=1 works in active / standby mode, and eth2 as a backup network card is no arp.
# P#
That is to say, in the active and standby mode, when a network interface fails (for example, the main switch is powered off, etc.), the system will work according to the order of the network card specified in cat / etc/rc.d/rc.local, and the machine can still serve externally, thus playing the function of failure protection.
In mode=0 load balancing mode, it can provide twice the bandwidth. Let's take a look at the configuration information of the network card.
In this case, the failure of a network card will only reduce the server exit bandwidth and will not affect the network usage.
Note: it is important to note that every time you change the mode of bond0, you need to restart your computer for the changes to take effect.
The network card binding technology under Linux not only increases the reliability of the server, but also increases the available network bandwidth, and provides users with uninterrupted key services.
This is the answer to the question about how to achieve load balancing and failure protection through dual-Nic binding in Linux. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.