In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how Linux binds dual network cards", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "How to bind dual network cards in Linux"!
1. Turn off iptables immediately and disable boot autostart
[root@mysql01 ~]# /etc/init.d/iptables stop
[root@mysql01 ~]# chkconfig iptables off
2.1 Stop NetworkManager
[root@mysql01 ~]# service NetworkManager stop
2.2 Power On Self-Start Off
[root@mysql01 ~]# chkconfig NetworkManager off
3. Create the file bonding.conf under/etc/modprobe.d/directory, configure the system to load the binding module, and add the following contents:
[root@mysql01 ~]# touch /etc/modprobe.d/bonding.conf
alias bond0 bonding
4. Configuration of related network cards
4.1、
cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE="bond0"
ONBOOT="yes"
#UUID=0470e854-c231-4f09-8b33-be707e619b1a
NM_CONTROLLED=no
IPADDR=135.125.21.85 #IP you set
NETMASK=255.255.255.0
GATEWAY=135.125.21.254
BONDING_OPTS="mode=1 miimon=100"
BOOTPROTO=none
Note: Use the default mode=1(active-backup) as the active-backup relationship, miimon is the number of milliseconds, and the event that detects line stability is triggered every 100 milliseconds.
4.2、
cat /etc/sysconfig/network-script/ifcfg-eth2
DEVICE="eth2"
#HWADDR="00:0C:29:44:29:84"
NM_CONTROLLED=no
ONBOOT="yes"
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
4.3、
cat /etc/sysconfig/network-script/ifcfg-eth3
DEVICE="eth3"
#HWADDR="00:0C:29:44:29:8E"
ONBOOT="yes"
MASTER=bond0
NM_CONTROLLED=no
SLAVE=yes
BOOTPROTO=none
5. Restart the network card
[root@mysql01 ~]# service network restart
[root@mysql01 ~]# ifconfig
Note: Under normal circumstances, HWaddr of bond0 eth2 eth3 is the same
6. Attach the Slave interface to bond0, vi /etc/rc.d/rc.local to make the binding network card take effect immediately, and add the following information: ifenslave bond0 eth2 eth3
[root@mysql01 ~]# vi /etc/rc.d/rc.local
ifenslave bond0 eth2 eth3
7. Test binding network
# cat /proc/net/bonding/bond0 (see NIC binding mode)
ping service ip gateway
There are seven modes of mode:
=0:(balance-rr) Round-robin policy: packets are transmitted sequentially until the last packet is transmitted, providing load balancing and fault tolerance.
=1:(active-backup) Active-backup policy: Only one device is active. One goes down and the other immediately goes from backup to master. MAC addresses are externally visible. This pattern provides fault tolerance.
=2:(balance-xor) XOR policy: (Broadcast policy): All packets are transmitted to all interfaces. This pattern provides fault tolerance.
=3:(balance-xor) XOR policy: (balance-xor): Transmission selects the transmission device based on the original address Boolean value. This pattern provides load balancing and fault tolerance.
=4:(802.3ad) IEEE 802.3ad Dynamic link aggregation.IEEE 802.3ad Dynamic link aggregation: Creates aggregation groups that share the same speed and duplex settings.
=5:(balance-tlb) Adaptive transmit load balancing (Adapter Transmission Load Balancer): Without special policies, if the first device fails to transmit, another device will take over the mac address being processed by the first device to help the previous device transmit.
=6:(balance-alb) Adaptive load balancing: (adapter transmission Load Balancer): roughly means including mode5, the bonding driver intercepts ARP requests sent from the local system and overrides the original address of the slave device with one of the hardware addresses. It's like having different hardware addresses for different people on a server.
Network card binding and switch relationship:
NIC bond mode=0, switch is not configured
NIC bond mode=1, switch aggregation
NIC bond mode=4, switch aggregation + 802.3 AD
Unbind NIC:
Remove ifcfg-bond0 and/etc/modprobe.d/bonding.conf
Modify ifcfg-eth0 and ifcfg-eth0 to what they were before binding
rmmod bonding (very important)
service network restart
At this point, I believe everyone has a deeper understanding of "how Linux binds dual network cards," so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
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.