新聞中心
這篇文章主要講解了“CentOS6.2網(wǎng)卡怎么設(shè)置”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“CentOS6.2網(wǎng)卡怎么設(shè)置”吧!
下面主要介紹在centos6.2下使用系統(tǒng)自帶的bonding進(jìn)行網(wǎng)卡綁定的詳細(xì)步驟。
注意:請(qǐng)?jiān)谂渲们瓣P(guān)閉networkmanager服務(wù)
[root@h63 ~]# service networkmanager status && service networkmanager start
網(wǎng)卡綁定一次可以綁定多個(gè)網(wǎng)卡,你可以使用ifconfig -a查看你的網(wǎng)卡信息,例如:
[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個(gè)網(wǎng)卡,分別是em1、em2、em3和em4,我們把em1和em2做一個(gè)綁定,綁定模式為6(關(guān)于網(wǎng)卡綁定模式的介紹請(qǐng)看linux網(wǎng)卡綁定探析),首先我給給網(wǎng)卡綁定后的設(shè)備起個(gè)名字bond0(名稱(chēng)可以自定義),并創(chuàng)建:
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-bond0
device=bond0 #設(shè)備名稱(chēng)
bootproto=static #靜態(tài)ip
onboot=yes #自動(dòng)啟動(dòng)
ipaddr=172.16.16.63 #設(shè)備綁定的ip
gateway=172.16.23.254 #設(shè)備綁定的網(wǎng)關(guān)
netmask=255.255.248.0 #設(shè)備綁定的掩碼
type=ethernet #設(shè)備綁定的類(lèi)型
編輯需要綁定的網(wǎng)卡:
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-em1
device=em1
bootproto=none
onboot=yes
master=bond0 #綁定后的設(shè)備名稱(chēng)
slave=yes
type=ethernet
[root@h63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-em2
device=em2
bootproto=none
onboot=yes
master=bond0 #綁定后的設(shè)備名稱(chēng)
slave=yes
type=ethernet
說(shuō)明:配置網(wǎng)卡時(shí)不要填寫(xiě)ip地址和mac地址
配置加載模式設(shè)置:
[root@h63 ~]# vim /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=6
說(shuō)明:mode是網(wǎng)卡綁定的模式,此處是模式6
也可以在/etc/modprobe.d/下創(chuàng)建一個(gè)文件:
[root@h63 ~]# vim /etc/modprobe.d/bond
alias bond0 bonding
options bond0 miimon=100 mode=6
綁定配置完成,重啟網(wǎng)絡(luò)服務(wù)
[root@h63 ~]#service network restart
查看網(wǎng)卡綁定的情況:
[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網(wǎng)卡怎么設(shè)置”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)CentOS6.2網(wǎng)卡怎么設(shè)置這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
分享標(biāo)題:CentOS6.2網(wǎng)卡怎么設(shè)置-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://www.dlmjj.cn/article/igeii.html