CentOS下雙網卡綁定

來源:互聯網
上載者:User

標籤: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下雙網卡綁定

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.