Linux dual-nic binding practices

Source: Internet
Author: User

Linux dual-nic binding practices
Preface

The work mainly focuses on SUSE, and the network is one of the most important links in the high-availability architecture. Physically, it is generally in the dual-nic binding mode. The default mode is usually 1 (active-backup) as the master-slave relationship.

In the production server that recently tested big data, the binding mode is set to mode = 6 (balance-alb), and the traffic is doubled by using Server Load balancer. In addition, in The SuSE HA architecture test from Skybility HA to Corosync/Openais + Pacemaker, mode = 0 (balance-rr) is used for network switch Port Channel link aggregation ), balanced round robin enables zero packet loss during network interruption.

The following uses CentOS as an example (similar to Red Hat). The dual-nic settings on other platforms are relatively simple. SuSE (YaST), AIX (SMIT), Windows (Intel ), if you have any requirements, you can reply to the message and I will update and supplement it later.

Follows the high availability principle to achieve Failure Protection and load balancing

Additional reading

  • Seven Nic binding modes-
Three common Bond modes for basic configuration information

The configuration process uses mode = 6 as an example. For the other 7 modes, refer to extended reading.

Mode = 0: Load Balancing mode, with automatic backup, but requires "Switch" support and settings. Mode = 1: automatic backup mode. If one line is disconnected, other lines are automatically backed up. Mode = 6: Load Balancing mode, automatic backup, no need to Switch support and settings.

Physical Interface
Interface IP Type
Eth0, eth2   Two production NICs
Eth3 10.129.46.19 Private address
Bond0 10.3.3.214 Dual Nic binding address
CentOS version
  1. Datanode01: ~> Cat/etc/RedHat-release
  2. CentOS release 6.4 (Final)
Disable NetworkManager
  1. # Disable NetworkManager immediately and disable auto-start upon startup
  2. /Etc/init. d/NetworkManager stop
  3. Chkconfig NetworkManager off
  4. /Etc/init. d/network restart
Disable iptables and selinux (optional)
  1. # Disable iptables immediately and disable auto-start upon startup
  2. /Etc/init. d/iptables stop
  3. Chkconfig iptables off
  4.  
  5. # Disable selinux immediately and disable selinux permanently
  6. Setenforce 0
  7. Sed-I's/SELINUX = enforcing/SELINUX = disabled/'/etc/selinux/config
Modify host name
  1. Vi/etc/sysconfig/network
  2.  
  3. NETWORKING = yes
  4. HOSTNAME = namenode01
  5.  
  6. # Refresh takes effect
  7. Hostname namnode01
  8. Source/etc/sysconfig/network
Configure the private IP Address
  1. Cd/etc/sysconfig/network-scripts
  2.  
  3. [Root @ datanode09 network-scripts] # cat ifcfg-eth3
  4. DEVICE = eth3
  5. ONBOOT = yes
  6. BOOTPROTO = none
  7. IPADDR = 10.129.46.19
  8. NETMASK = 255.255.255.0
  9. IPV6INIT = no
  10. USERCTL = no
Bind two NICs
  1. Cd/etc/sysconfig/network-scripts
  2.  
  3. # Edit eth0
  4. Cat> ifcfg-eth0 <EOF
  5. DEVICE = eth0
  6. ONBOOT = yes
  7. BOOTPROTO = none
  8. USERCTL = no
  9. MASTER = bond0
  10. EOF
  11.  
  12. # Edit eth2
  13. Cat> ifcfg-eth2 <EOF
  14. DEVICE = eth2
  15. ONBOOT = yes
  16. BOOTPROTO = none
  17. USERCTL = no
  18. MASTER = bond0
  19. EOF
  20.  
  21. # Edit bond0
  22. Cat> ifcfg-bond0 <EOF
  23. DEVICE = bond0
  24. TYPE = Ethernet
  25. ONBOOT = yes
  26. BOOTPROTO = none
  27. IPADDR = 10.3.3.214
  28. NETMASK = 255.255.255.0
  29. GATEWAY = 10.3.3.1
  30. IPV6INIT = no
  31. USERCTL = no
  32. EOF
  33.  
  34. # Set bond parameters. Pay attention to mode selection.
  35. Cat>/etc/modprobe. conf <EOF
  36. Alias bond0 bonding
  37. Options bond0 miimon = 100 mode = 6
  38. EOF
  39.  
  40. # Add auto-start Parameters
  41. Cat>/etc/rc. local <EOF
  42. Ifenslave bond0 eth0 eth2
  43. EOF
  44.  
  45. # Restart an Eni
  46. Service network restart
  47.  
  48. # Make the bound Nic effective immediately
  49. Ifenslave bond0 eth0 eth2
  50.  
  51. # Test network binding
  52. Ping 10.3.3.1
  53.  
Comparison of three common Nic binding modes mode = 0

Interrupt any link or restore link, zero packet loss on the network

Advantage: traffic is doubled

Disadvantage: You need to connect to the same vswitch for aggregation configuration, so the high availability of the physical switch cannot be guaranteed (Cisco seems to have a solution ?)

Mode = 1

When one link is interrupted, 1-3 packets are lost (in seconds), and zero packet loss is restored.

Advantage: No need to configure the vswitch

Disadvantages:

Mode = 6

Zero packet loss occurs when any link is interrupted. 10-15 packets are lost when the link is recovered (in seconds)

Advantage: vswitches do not need to be configured, and the traffic is doubled

Disadvantage: Packet Loss takes too long to recover the link.

This article permanently updates the link address:

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.