您好,登錄后才能下訂單哦!
這篇文章主要講解了“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網卡怎么設置這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。