CentOS6.9 realizes dual network card binding

1, create a bond0 file

# vi /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

NM_CONTROLLED=no #Whether your network card is managed by networkmanager, details later Speaking

BOOTPROTO=static #The way to get the IP address, you can choose dynamic (dhcp), static (static) ), do not get (none)

ONBOOT=yes

IPADDR=192.168.10.33

NETMASK=255.255.255.0

GATEWAY=192.168.10.254

< p>USERCTL=no #Whether to allow non-root users to control the device

BONDING_OPTS=”mode=1 miimon=100″ #Binding mode, we will talk about it in detail later

2, modify the eth0 file

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

< p>NM_CONTROLLED=no

ONBOOT=yes

TYPE=Ethernet

MASTER=bond0

SLAVE= yes

USERCTL=no

2. Modify the eth1 file

# vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

BOOTPROTO=none

< p>NM_CONTROLLED=no

ONBOOT=yes

TYPE=Ethernet

MASTER=bond0

SLAVE= yes

USERCTL=no

3. Add a kernel module

# vi /etc/modprobe.d/dist.conf

Add the following two lines at the end of the file:

alias bond0 bonding

options bond0 mode=1 miimon=100

4. Set to execute automatic binding when the system starts

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

Add at the end of the file:

ifenslave bond0 eth0 eth1

< strong>5. Close NetworkManager (if any)

# service NetworkManager stop< /span>

# chconfig NetworkManager off

6. Restart the system to check whether bond0 is enabled correctly

7 , About NM_CONTROLLED

If you set NM_CONTROLLED=yes, use networkmanager to manage the network card. When restarting the network, you need to restart the networkmanage first, and then restart the network. For remote users, it may cause the server to no longer be able to connect. Because the network is disconnected when the networkmanager is restarted, it is generally set to no here

8. About the binding mode BONDING_OPTS=”mode=1 miimon=100″

miimon: generally set the miimon value to 100, which means that the system monitors the link connection status every 100ms

mod=0 balance Round-robin mode

mod=1 active/standby mode

mod=2 balance strategy

mod=3 broadcast strategy

mod=4 Dynamic link aggregation

mod=5 Adapter Transmission Load Balancing

mod=6 Adapter Adaptive Load Balancing

Detailed explanation can be found here: https://my .oschina.net/jastme/blog/491095

Leave a Comment

Your email address will not be published.