Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up the CentOS6.2 network card

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to set up the CentOS6.2 network card". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to set up the CentOS6.2 network card".

The following is mainly about the detailed steps of binding the Nic using the bonding that comes with the system under centos6.2.

Note: please turn off the networkmanager service before configuration

[root@h63] # service networkmanager status & & service networkmanager start

You can bind multiple network cards at a time. You can use ifconfig-a to view your network card information, for example:

[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.0b) tx bytes:0 (0.0b)

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.0b) tx bytes:0 (0.0b)

Interrupt:42 memory:dc000000-dc012800

There are four network cards, namely em1, em2, em3 and em4. We bind em1 and em2 with a binding mode of 6 (for an introduction to the binding mode of network card, please see the binding analysis of linux network card). First of all, I give the device bound to the network card the name bond0 (the name can be customized), and create:

[root@h63 ~] # vim / etc/sysconfig/network-scripts/ifcfg-bond0

Device=bond0 # device name

Bootproto=static # static ip

Onboot=yes # automatic start

Ipaddr=172.16.16.63 # ip bound to the device

Gateway=172.16.23.254 # Gateway bound to the device

Netmask=255.255.248.0 # Mask bound to the device

Type=ethernet # types of device bindings

Edit the network card that needs to be bound:

[root@h63 ~] # vim / etc/sysconfig/network-scripts/ifcfg-em1

Device=em1

Bootproto=none

Onboot=yes

Master=bond0 # bound device name

Slave=yes

Type=ethernet

[root@h63 ~] # vim / etc/sysconfig/network-scripts/ifcfg-em2

Device=em2

Bootproto=none

Onboot=yes

Master=bond0 # bound device name

Slave=yes

Type=ethernet

Note: do not fill in the 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

Description: mode is the binding mode of the network card, here is mode 6

You can also create a file under / etc/modprobe.d/:

[root@h63 ~] # vim / etc/modprobe.d/bond

Alias bond0 bonding

Options bond0 miimon=100 mode=6

Binding configuration is complete, restart the network service

[root@h63 ~] # service network restart

Check the binding of the Nic:

[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

Thank you for your reading, the above is the content of "how to set up the CentOS6.2 network card". After the study of this article, I believe you have a deeper understanding of how to set up the CentOS6.2 network card, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report