Manual switch between two NICs and bond binding

Source: Internet
Author: User

On the morning of the day before yesterday, the leader determined that the network card of the 172.16.30.160 host had errors and packet loss. He planned to switch the network card that night: manually switch from eth0 to eth1.

[[email protected] bond0]$ /sbin/ifconfig eth0eth0      Link encap:Ethernet  HWaddr E4:1F:13:BC:5C:90            UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1          RX packets:375922390 errors:2869 dropped:2241420 overruns:0 frame:2869          TX packets:1012710669 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000           RX bytes:29481710520 (27.4 GiB)  TX bytes:1400156478780 (1.2 TiB)          Interrupt:169 Memory:92000000-92012800

In the evening of the same day, the DBA did not agree to this operation.

However, since we had a plan to switch the network card before lunch, I was about to search for information from the Internet. Linux applications have been used in the past two years, and hardware configurations have never been used. As some machines in the IDC are still relatively old, it is estimated that drivers will be re-installed in the future. Taking advantage of this opportunity, I just want to complete the course.

I began to collect data on Baidu around half past four P.M. the day before yesterday. I watched the data for half a day yesterday. I watched the data for a whole day this morning.

I have read about 12 articles, and almost all of them mean the same thing. It is nothing more than the principle and meaning of NIC binding. Copy the configuration file eth0 and start the module.

After reading more, I got a few impressions. However, I did not explain how to switch from eth0 to eth1 in "Active-Backup" mode.

In the afternoon of the day before yesterday, find a configuration file:

[[email protected] bond0]$ cat /proc/net/bonding/bond0Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)Bonding Mode: fault-tolerance (active-backup)Primary Slave: eth0Currently Active Slave: eth0MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 0Down Delay (ms): 0Slave Interface: eth0MII Status: upLink Failure Count: 1127Permanent HW addr: e4:1f:13:bc:5c:90Slave Interface: eth1MII Status: upLink Failure Count: 3Permanent HW addr: e4:1f:13:bc:5c:92

The leader said, not in this document. Yes, and you do not have the write permission.

[[email protected] bond0]$ ll /proc/net/bonding/bond0-r--r--r-- 1 root root 0 Sep 19 18:03 /proc/net/bonding/bond0

This morning, I saw an article in which I wrote the following paragraph:

/Sys/class/NET/bond0 contains various attributes of the bond0 port. Each attribute is a file. These attribute files are the same as text files. To view the attributes, run the "cat attribute file" command.

[[email protected] bond0]$ lltotal 0-r--r--r-- 1 root root 4096 Feb 22  2014 address-r--r--r-- 1 root root 4096 Sep 19 10:50 addr_lendrwxr-xr-x 2 root root    0 Sep 19 10:51 bonding-r--r--r-- 1 root root 4096 Feb 22  2014 broadcast-r--r--r-- 1 root root 4096 Sep 19 10:50 carrier-r--r--r-- 1 root root 4096 Sep 19 10:50 dormant-r--r--r-- 1 root root 4096 Sep 19 10:50 features-rw-r--r-- 1 root root 4096 Sep 19 10:50 flags-r--r--r-- 1 root root 4096 Sep 19 10:50 ifindex-r--r--r-- 1 root root 4096 Sep 19 10:50 iflink-r--r--r-- 1 root root 4096 Sep 19 10:50 link_mode-rw-r--r-- 1 root root 4096 Sep 19 10:50 mtu-r--r--r-- 1 root root 4096 Sep 19 10:50 operstatelrwxrwxrwx 1 root root    0 Sep 19 10:50 slave_eth0 -> ../../../class/net/eth0lrwxrwxrwx 1 root root    0 Sep 19 10:50 slave_eth1 -> ../../../class/net/eth1drwxr-xr-x 2 root root    0 Feb 22  2014 statisticslrwxrwxrwx 1 root root    0 Feb 22  2014 subsystem -> ../../../class/net-rw-r--r-- 1 root root 4096 Sep 19 10:50 tx_queue_len-r--r--r-- 1 root root 4096 Feb 22  2014 type--w------- 1 root root 4096 Sep 19 10:50 uevent-rw-r--r-- 1 root root 4096 Sep 19 10:50 weight[[email protected] bond0]$ pwd/sys/class/net/bond0

To modify attributes, run the "Echo property value> attribute file" command.

But what if I want to modify the file to switch the Nic?

After reading all the collected documents, no answer is found. Find another leader this afternoon to verify that in Mode-1 mode, eth0 will automatically switch to eth1 only when it encounters a fault. However, let's switch to eth1 manually. Should we modify the configuration file there? He showed me several configuration files in the ifcfg-eth0 directory, but, after he looked at them carefully, the results repeat these two days of my questions.

Finally, he said, "In this case, the eth0 will be down. Let's switch over ......"


I am unwilling to answer this question, and I will go to the oldboy group to ask this question. The result is the same as that of the lead.

At present, it seems that this problem will come first here. However, I always think that if you want to change the configuration file, you should also move something in the/sys/class/NET/bond0 directory.


This article is from the "dark-matter" blog, please be sure to keep this source http://gagarin.blog.51cto.com/1056957/1555297

Manual switch between two NICs and bond binding

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.