linux 雙網卡綁定以及解除綁定雙網卡方法__linux

來源:互聯網
上載者:User

Centos6.X配置網卡綁定


(主要瞭解三種模式:mode=0,1,6.)

先停止NetworkManager
service NetworkManager stop 
chkconfig NetworkManager off   //開機自啟動 關閉


在/etc/sysconfig/network-scripts/目錄下建立ifcfg-bond0檔案,檔案內容如下:
DEVICE=bond0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.100.17    //你所設定的IP
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
TYPE=UnKnown    //或者Ethernet (若Networkmanager未關閉 就用unknown )
BONDING_OPTS="miimon=80 mode=0"   //這一步也可以在下面 /etc/modprobe.d/bonidng.conf 裡面填寫


綁定mode為0,是rond-robin模式。
然後分別修改ifcfg-eth0檔案,如下:
DEVICE="eth0"
ONBOOT="yes"
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no
在把ifcfg-eth1檔案修改如下:
DEVICE="eth1"
ONBOOT="yes"
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no

在/etc/modprobe.d/目錄下建立bonding.conf檔案,檔案內容如下:
alias bond0 bonding

---若上一面bond0 配置未填寫 BONDING_OPTS,這裡再另起一行:options bond0 miimon=100 mode=0


執行modprobe  bonding

然後重啟網路service network restart

-------如果用遠端連線的話 請使用:modprobe bonding&&service network restart
之後就可以用ifconfig-a看到綁定好的bond0網卡,bond0與eth0,eth1的mac地址均為一樣。
可以同過cat/proc/net/bonding/bond0 此命令查看綁定情況

網卡綁定解除:

刪除ifcfg-bond0,和刪除/etc/modprobe.d/bonding.conf

修改ifcfg-eth0和ifcfg-eth0為綁定之前的樣子

rmmod bonding(很重要)

service network restart



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.