標籤:bond 雙網卡
像流媒體傳輸之類的伺服器使用單網卡負載過高,可能造成畫面卡頓情況,為緩解網路壓力,特進行雙網卡綁定。
這裡我們將2塊1GB的網卡進行綁定,使其頻寬達到2GB,從而減少網路擁塞。
1.修改/etc/sysconfig/network-scripts/ifcfg-eth0/1配置文檔,內容如下:
BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes
2.建立一個綁定網路口的配置文檔/etc/sysconfig/network-scripts/ifcfg-bond0,內容如下:
DEVICE=bond0BOOTPROTO=static IPADDR=52.110.1.2NETMASK=255.255.255.0GATEWAY=52.110.1.1BORADCAST=52.110.1.255ONBOOT=yesTYPE=Ethernet
3.修改/etc/modprobe.d/dist.conf,配置綁定模型,設定檔最後加入以下內容:
alias bond0 bondingoptions bond0 miimon=100 mode=0
#選項 millmon 是指定隔多長時間來進行鏈路監測,單位是ms。
#選項 mode 是表示綁定口的工作模式,有0-7共7種模式,常用的有0和1模式,mode=0表示"round-robin"策略,兩張卡同時工作在負載平衡狀態。mode=1表示"active-backup"策略,兩張卡一用一備的備份狀態。
4. 修改的是/etc/rc.local,負責在系統啟動時將虛擬網卡和兩張物理網卡相綁定,增加以下內容:
echo "ifenslave bond0 eth0 eth1" >>/etc/rc.local
5.重啟網卡,使其生效
service network restart
注意:將networkmanager服務關閉並設定為開機不啟動 以防止幹擾相關的操作
service NetworkManager stopchkconfig NetworkManager off
測試:關閉其中任何一塊綁定的網卡,網路不受影響。
附:測試網卡介面速度 ethtool
[[email protected] ~]# ethtool eth0Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on MDI-X: off Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000007 (7) drv probe link Link detected: yes
本文出自 “夢想人生” 部落格,請務必保留此出處http://hzde0128.blog.51cto.com/918211/1836378
CentOS下雙網卡綁定