CentOS 6.2 network card Settings
- 2020-05-07 20:46:33
- OfStack
The following mainly introduces the detailed steps of network card binding under CentOS6.2 using bonding which comes with the system.
Note: please turn off the NetworkManager service before configuring
[root@h63 ~]# service NetworkManager status && service NetworkManager start
Network card binding can bind multiple network CARDS once, you can use ifconfig-a to view your network card information, such as:
[root@h63 ~]# ifconfig -a
em1 Link encap:Ethernet HWaddr 78:2B:CB:30:08:03
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:48236002 errors:0 dropped:0 overruns:0 frame:0
TX packets:16156472 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4838973371 (4.5 GiB) TX bytes:1301118550 (1.2 GiB)
Interrupt:36 Memory:d6000000-d6012800
em2 Link encap:Ethernet HWaddr 78:2B:CB:30:08:05
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:42385720 errors:0 dropped:0 overruns:0 frame:0
TX packets:7283526 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4307780986 (4.0 GiB) TX bytes:466840625 (445.2 MiB)
Interrupt:48 Memory:d8000000-d8012800
em3 Link encap:Ethernet HWaddr 78:2B:CB:30:08:07
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:32 Memory:da000000-da012800
em4 Link encap:Ethernet HWaddr 78:2B:CB:30:08:09
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:42 Memory:dc000000-dc012800
There are four network CARDS, em1, em2, em3 and em4, respectively. We make a binding between em1 and em2, and the binding mode is 6 (for the introduction of network card binding mode, please see the analysis of Linux network card binding). First, I give the device after network card binding a name bond0 (the name can be customized), and create:
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0# device name
Static IP BOOTPROTO = static #
ONBOOT=yes # starts automatically
IPADDR=172.16.16.63# device bound IP
GATEWAY=172.16.23.254 # device binding gateway
NETMASK=255.255.248.0 # mask for device binding
TYPE=Ethernet # type of device binding
Edit the network card that needs to be bound:
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
BOOTPROTO=none
ONBOOT=yes
Name of device after MASTER=bond0# binding
SLAVE=yes
TYPE=Ethernet
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0# device name after binding
SLAVE=yes
TYPE=Ethernet
Note: do not fill in IP address and MAC address when configuring the network card
Configure load mode Settings:
[root@h63 ~]# vim /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=6
Note: mode is the network card binding mode, here is mode 6
Can also be in the/etc/modprobe d/create a file:
[root@h63 ~]# vim /etc/modprobe.d/bond
alias bond0 bonding
options bond0 miimon=100 mode=6
Bind configuration complete, restart the network service
[root@h63 ~]#service network restart
View the network card binding:
[root@h63 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
Bonding Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: em1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: em1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 78:2b:cb:30:08:03
Slave queue ID: 0
Slave Interface: em2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 78:2b:cb:30:08:05
Slave queue ID: 0
At this point, the network card binding is complete. If there is anything wrong, please advise.