歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux下多網卡綁定

Linux下多網卡綁定

日期:2017/2/28 15:31:03   编辑:Linux教程

假定將eth0,eth1,eth2,eth3綁定成bond0, 步驟如下:

(1) #vi /etc/modprobe.conf, 添加如下2行:

alias bond0 bonding

options bonding miimon=100 mode=4

當mode=0時,交換機相應端口不需要做trunk,但是從節點上ping網關(192.*.*.*)有較大的延時。解決此問題的辦法是把mode改成4,同時配置交換機相應端口開啟鏈路聚合並捆綁為trunk。

在modprobe.conf文件中,

miimon參數用來監測網卡物理連接,建議至少設為100

mode參數用來設置綁定模式

0 負載均衡(round robin策略)

1 active/backup模式,同一時間只有一塊網卡使用。

2 負載均衡(xor算法)

3 廣播模式

4 802.3ad模式,lagp協議,帶寬翻倍。

模式不能寫錯

這裡很容易出現不穩定的情況,多半是這裡模式選擇錯了,所以在實施的時候需要小心,把模式確定了,然後在動手。

(2)修改/etc/sysconfig/network-scripts/目錄下的ifcfg-bond0, ifcfg-eth0, ifcfg-eth1,ifcfg-eth2,ifcfg-eth3. 具體內容如下:
[root@io102 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@io102 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
BOOTPROTE=static
ONBOOT=yes
IPADDR=192.*.*.*
NETMASK=255.255.255.0
USERTCL=no
GATEWAY=192.*.*.*
[root@io102 network-scripts]# cat ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERTCL=no
MASTER=bond0
SLAVE=yes
[root@io102 network-scripts]# cat ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERTCL=no
MASTER=bond0
SLAVE=yes
[root@io102 network-scripts]# cat ifcfg-eth2
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERTCL=no
MASTER=bond0
SLAVE=yes
[root@io102 network-scripts]# cat ifcfg-eth3
DEVICE=eth3
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
USERTCL=no
MASTER=bond0
SLAVE=yes

Copyright © Linux教程網 All Rights Reserved