Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure multiple Nic bindings with centos6.8

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to configure multiple network card bindings for centos6.8, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

Linux's own software bonding can bundle multiple network interface devices into a single network interface setting for network load balancing and network redundancy. Network load balancer is often used in our file server, which is under great network pressure when multiple users use it at the same time, so in order to solve the problem that the same IP breaks through the traffic limit, using multiple network cards to bind is an excellent way. Network redundancy is also very important in the production environment, especially when the network card may be physically damaged and cannot use the same IP to respond quickly at the same time. Bonding provides redundant support for the network card, binding multiple network cards to an IP, even if one of the network cards is physically damaged, the other network card is automatically enabled and provides normal service.

Let's first take a look at the common mode categories of bonding:

Mode=0, that is, (balance-rr) Round-robin policy (balanced Loop Policy) data packet transmission method polling transmission, the first packet is transmitted to eth0, the second packet is transmitted to eth2, and the cycle goes on until the transmission is completed. It should be noted that mode0 can act as a load balancer and does not provide fault tolerance. If the first network card fails, the network will be paralyzed.

Mode=1, that is, (active-backup) Active-backup policy (master-backup policy), only one is active. When the primary network card fails, the standby network card changes from standby to primary immediately. This model provides high fault tolerance. But the utilization rate of resources is low.

Mode=3, that is, broadcast (broadcast policy) transmits each packet on each slave interface, which provides fault tolerance

Demo environment: VMware version 11, system centos 6.8

Step one:

First of all, we add a new network card, restart and take effect.

Step 2: turn off the NetworkManager service (there is a conflict between enabling NetworkManager and bonding in the centos6 series version)

[root@centos6 ~] # service NetworkManager stop

Stopping NetworkManager daemon: [OK]

[root@centos6 ~] # chkconfig NetworkManager off

Step 3: create a virtual network card bond0, and create a new virtual network card band0 in the / etc/sysconfig/network-scripts directory. The mode used here is 1, and the file content is shown in the figure.

[root@centos6 ~] # vim / etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

BOOTPROTO=none

BONDING_OPTS= "miimon=100,mode=1"

IPADDR=10.1.45.181

PREFIX=16

GATEWAY=10.1.0.1

The fourth step: configure the network card parameters, the network card name, the role of the network card and the name of the virtual master card need to be marked in the network card parameters.

[root@centos6 ~] # vim / etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

SLAVE=yes

MASTER=bond0

[root@centos6 ~] # vim / etc/sysconfig/network-scripts/ifcfg-eth2

DEVICE=eth2

SLAVE=yes

MASTER=bond0

Step 5: restart the network card to check the status

Use my other host ping status to pass

Connecting to 10.1.45.180:22...

Connection established.

To escape to local shell, press' Ctrl+Alt+]'.

Last login: Thu Sep 1 14:51:24 2016 from 10.1.250.31

Welcome to the home of snowbamboo ^ ^

[root@localhost ~] # ping 10.1.45.181

PING 10.1.45.181 (10.1.45.181) 56 (84) bytes of data.

64 bytes from 10.1.45.181: icmp_seq=1 ttl=64 time=1.63 ms

64 bytes from 10.1.45.181: icmp_seq=2 ttl=64 time=0.354 ms

64 bytes from 10.1.45.181: icmp_seq=3 ttl=64 time=0.250 ms

64 bytes from 10.1.45.181: icmp_seq=4 ttl=64 time=0.514 ms

64 bytes from 10.1.45.181: icmp_seq=5 ttl=64 time=0.282 ms

64 bytes from 10.1.45.181: icmp_seq=6 ttl=64 time=0.252 ms

64 bytes from 10.1.45.181: icmp_seq=7 ttl=64 time=0.361 ms

64 bytes from 10.1.45.181: icmp_seq=8 ttl=64 time=0.310 ms

64 bytes from 10.1.45.181: icmp_seq=9 ttl=64 time=0.426 ms

64 bytes from 10.1.45.181: icmp_seq=10 ttl=64 time=0.439 ms

64 bytes from 10.1.45.181: icmp_seq=11 ttl=64 time=0.506 ms

64 bytes from 10.1.45.181: icmp_seq=12 ttl=64 time=0.502 ms

64 bytes from 10.1.45.181: icmp_seq=13 ttl=64 time=0.423 ms

64 bytes from 10.1.45.181: icmp_seq=14 ttl=64 time=0.230 ms

64 bytes from 10.1.45.181: icmp_seq=15 ttl=64 time=0.494 ms

64 bytes from 10.1.45.181: icmp_seq=16 ttl=64 time=0.417 ms

64 bytes from 10.1.45.181: icmp_seq=17 ttl=64 time=0.522 ms

Now I close a network card to see if there are any fluctuations in the network.

Summary:

When using the mode1 of bonding, there must be at least two network cards, one for the active network card and the other for the standby state. when the primary card fails, the standby card immediately takes over the work and continues to complete the data transmission. In mode0 mode, it should be noted that mode0 only supports load balancing and accelerates the transmission of network packets, and there is no fault tolerance.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report