CentOS6.2网卡怎么设置
这篇文章主要讲解了“CentOS6.2网卡怎么设置”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“CentOS6.2网卡怎么设置”吧!
成都创新互联专注于广德企业网站建设,自适应网站建设,商城网站建设。广德网站建设公司,为广德等地区提供建站服务。全流程按需制作网站,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务
下面主要介绍在centos6.2下使用系统自带的bonding进行网卡绑定的详细步骤。
注意:请在配置前关闭networkmanager服务
[root@h63 ~]# service networkmanager status && service networkmanager start
网卡绑定一次可以绑定多个网卡,你可以使用ifconfig -a查看你的网卡信息,例如:
[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
这里有4个网卡,分别是em1、em2、em3和em4,我们把em1和em2做一个绑定,绑定模式为6(关于网卡绑定模式的介绍请看linux网卡绑定探析),首先我给给网卡绑定后的设备起个名字bond0(名称可以自定义),并创建:
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-bond0
device=bond0 #设备名称
bootproto=static #静态ip
onboot=yes #自动启动
ipaddr=172.16.16.63 #设备绑定的ip
gateway=172.16.23.254 #设备绑定的网关
netmask=255.255.248.0 #设备绑定的掩码
type=ethernet #设备绑定的类型
编辑需要绑定的网卡:
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-em1
device=em1
bootproto=none
onboot=yes
master=bond0 #绑定后的设备名称
slave=yes
type=ethernet
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-em2
device=em2
bootproto=none
onboot=yes
master=bond0 #绑定后的设备名称
slave=yes
type=ethernet
说明:配置网卡时不要填写ip地址和mac地址
配置加载模式设置:
[root@h63 ~]# vim /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=6
说明:mode是网卡绑定的模式,此处是模式6
也可以在/etc/modprobe.d/下创建一个文件:
[root@h63 ~]# vim /etc/modprobe.d/bond
alias bond0 bonding
options bond0 miimon=100 mode=6
绑定配置完成,重启网络服务
[root@h63 ~]#service network restart
查看网卡绑定的情况:
[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
感谢各位的阅读,以上就是“CentOS6.2网卡怎么设置”的内容了,经过本文的学习后,相信大家对CentOS6.2网卡怎么设置这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
当前标题:CentOS6.2网卡怎么设置
网页链接:http://myzitong.com/article/gpjdeg.html