Tips on Nic configuration and dual Nic binding in CentOS

Source: Internet
Author: User

Tips on Nic configuration and dual Nic binding in CentOS

Centos6 Nic Configuration

Standard document

/Etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE = "eth0"

BOOTPROTO = static

NM_CONTROLLED = "yes"

ONBOOT = "yes"

TYPE = "Ethernet"

UUID = "e8d096fd-3e45-4303-8f7e-aa1808e03dba"

HWADDR = 00: 0C: 29: D6: CE: 89

IPADDR = 192.168.10.119

PREFIX = 24

GATEWAY = 192.168.10.1

DEFROUTE = yes

20174_failure_fatal = yes

USERCTL = no

NAME = "System eth0"

DNS1 = 8.8.8.8

DNS2 = 8.8.4.4

Note:

NM_CONTROLLED = yes indicates that the network adapter eth0 must be hosted by NetworkManager. Changes to yes | no switch control items in this line take effect immediately. Network Manager is actually a graphical Network Manager for managing Network devices in the upper right corner of the screen. It is very convenient to help you manage wireless, ADSL, VPN, etc, service NetworkManager start | stop determines whether you can see it in the upper right corner, NM_CONTROLLED = yes | no in the main configuration file of eth0 Nic determines whether your eth0 can be managed by NNetwork Manager. When NM_CONTROLLED = yes, You need to restart the NetworkManager service and restart the network service to make the NIC configuration take effect, at this time, you can use NetworkManager to manage your Nic devices, such as eth0 and ppp0. When NM_CONTROLLED = no, you want to make the NIC configuration take effect, you don't need to restart the NetworkManager service. Simply restart the network service. The only downside is that you cannot use NetworkManager to manage your Nic devices, such as eth0 and ppp0. In addition, Nic configuration considerations when configuring kvm bridge: NM_CONTROLLED = yes in eth0 (actual Nic) and NM_CONTROLLED = no in br0 (NIC. After service network restart is configured, run the ifconfig command to check whether the related interface is active.

USERCTL = no # whether to allow non-root users to control the device, set to no, can only be changed by the root user

ONBOOT = "yes" # ONBOOT indicates whether to activate the NIC when the system starts. Only the NIC in the active status can connect to the network for network communication. YES means activation, and NO means not activation. RHEL6 and later versions are NO by default.

Configure dual-nic binding for CentOS6.x and later

Prerequisites: The NIC chipset model is the same, and the NIC should have its own independent BIOS chip.

1. Edit the virtual network interface configuration file and specify the nic ip Address

Vi/etc/sysconfig/network-scripts/ifcfg-bond0

[Root @ redflag root] # cp/etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-bond0

2 configure bond0

# Vi ifcfg-bond0

Change the first line to DEVICE = bond0

# Cat ifcfg-bond0

DEVICE = bond0

BOOTPROTO = static

IPADDR = 172.31.3.13

NETMASK = 255.255.255.0

BROADCAST = 172.31.3.255

GATEWAY = 172.31.3.254

ONBOOT = yes

TYPE = Ethernet

Do not specify the IP address, subnet mask, or Nic ID of a single Nic. Specify the above information to the virtual adapter (bonding.

[Root @ redflag network-scripts] # cat ifcfg-eth0

DEVICE = eth0

USERCTL = no

BOOTPROTO = none

ONBOOT = yes

MASTER = bond0

SLAVE = yes

[Root @ redflag network-scripts] # cat ifcfg-eth1

DEVICE = eth1

USERCTL = no

BOOTPROTO = none

ONBOOT = yes

MASTER = bond0

SLAVE = yes

3 # vi/etc/modules. conf

Edit the/etc/modules. conf file and add the following line to enable the system to load the bonding module at startup. The external virtual network interface device is bond0.

 

Add the following two rows

Alias bond0 bonding

Options bond0 miimon = 100 mode = 0

Note: miimon is used for link monitoring. For example: miimon = 100, The system monitors the link connection status every Ms. If one line fails, it is transferred to another line. The value of mode indicates the working mode, which has a total, two or three modes, commonly used: 0, 1.

Mode = 0 indicates that the load balancing (round-robin) method is load balancing, and both NICs work. The load balancing mode provides twice the bandwidth. In this case, the failure of a NIC only results in a decrease in the outbound bandwidth of the server and does not affect network usage.

Mode = 1 indicates that fault-tolerance (active-backup) provides redundancy, working in the active/standby mode. That is to say, by default, only one network card works and the other is used for backup. in Master/Slave Mode, when a network interface fails (for example, the master switch loses power) and the network is not interrupted, the system will follow/etc/rc. d/rc. in local, the specified Nic works in sequence, and the machine can still provide external services, enabling the failure protection function.

Bonding can only provide link monitoring, that is, whether the link from the host to the switch is connected. If the external link of the switch is down and the switch is not faulty, bonding considers that the link is correct and continues to be used.

4 # vi/etc/rc. d/rc. local

Add two rows

Ifenslave bond0 eth0 eth1

Route add-net 172.31.3.254 netmask limit 255.255.0 bond0

Route add-net 192.168.228.0 netmask 255.255.255.0 gw 192.168.228.254 dev eth0

# Service network restart

After the configuration is complete, restart the machine.

The following information is displayed after restart, indicating that the configuration is successful.

................

Bringing up interface bond0 OK

Bringing up interface eth0 OK

Bringing up interface eth1 OK

................

In Linux, network card bonding technology not only increases server reliability, but also increases available network bandwidth, to provide users with uninterrupted key services.

This article from the "Drop water stone sunjie" blog, please be sure to keep this source http://xjsunjie.blog.51cto.com/999372/1407476

Related Article

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.