一部作為集中備份的主機,平時經由網路接收來自多個不同主機的備份資料串流,故此備份主機需將多個實體網路介面卡應用頻寬聚合技術實現可用網路頻寬最大化。
系統環境
ifcfg-eth0:
DEVICE=eth0 MASTER=bond0 SLAVE=yes BOOTPROTO=none HWADDR=28:80:23:b6:6f:54 ONBOOT=yes USERCTL=no
TIP: eth0-7 的設定都相同,除了 HWADDR 與 DEVICE 以外
ifcfg-bond0:
DEVICE=bond0 BOOTPROTO=none IPADDR=10.18.1.32 NETMASK=255.255.248.0 GATEWAY=10.18.0.254 DNS1=192.168.21.12 DOMAIN=xxxx.com ONBOOT=yes #BONDING_OPTS="mode=6 miimon=100" BONDING_OPTS="mode=4 miimon=100 lacp_rate=1 xmit_hash_policy=layer3+4"
NOTE: mode 4 對於所連接的 Switch 設備也需要做相應的設定,詳細在文中下方有說明;如果 Switch 端沒有作設定,網路會出錯。
/etc/modprobe.d/bond.conf:
alias bond0 bonding
網路狀態:
[root@win-tsmb2 ~]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.4.0-2 (October 7, 2008) Bonding Mode: IEEE 802.3ad Dynamic link aggregation Transmit Hash Policy: layer3+4 (1) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 802.3ad info LACP rate: fast Active Aggregator Info: Aggregator ID: 9 Number of ports: 4 Actor Key: 17 Partner Key: 2 Partner Mac Address: 4c:bc:48:22:f1:80 Slave Interface: eth0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 28:80:23:b6:6f:54 Aggregator ID: 9 Slave Interface: eth1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 28:80:23:b6:6f:55 Aggregator ID: 9 Slave Interface: eth2 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 28:80:23:b6:6f:56 Aggregator ID: 9 Slave Interface: eth3 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 28:80:23:b6:6f:57 Aggregator ID: 9 Slave Interface: eth4 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 3c:a8:2a:e4:2c:9c Aggregator ID: 10 Slave Interface: eth5 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 3c:a8:2a:e4:2c:9d Aggregator ID: 10 Slave Interface: eth6 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 3c:a8:2a:e4:2c:9e Aggregator ID: 10 Slave Interface: eth7 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 3c:a8:2a:e4:2c:9f Aggregator ID: 10
TIP:
- 從每個 port 的 Aggregator ID 可以得知這些 port 分別接上兩個不同的 switch 設備
- 從 Number of ports 可以得知聚合 4 port 的頻寬 (1Gbps x 4)
- 這裡的設定不只有頻寬聚合還兼具 Fault Tolerance
1. Set LACP mode by port
channel-group 2 mode active
NOTE: 這裡設定是配合 Linux 的 bonding mode = 4
2. Set Load-Balance mode by switch
port-channel load-balance src-ip
TIP:
- mode active 就是 LACP mode
- 這裡的 switch 是指連接備份主機最近的 edge switch 設備
注意: 這裡頻寬聚合是指有多個不同來源 IP 的網路資料傳輸時可以同時使用多個 Port 的頻寬,而對單一來源 IP 的網路傳輸最大頻寬仍是單 Port 的上限(1Gbps)。
使用多個不同的電腦,同時使用不同的服務,例如 scp, ftp, NFS,從主機下載任意大檔至各個不同的電腦,觀察主機的網路傳輸頻寬應該要大於 1Gbps。
如果沒有,表示沒有頻寬聚合效果,檢查主機網路設定的 mode 有無加上 hash_policy=layer3+4 。
使用多個不同的電腦,同時使用不同的服務,例如 scp, ftp, NFS,從各個不同的電腦下載任意大檔至主機,觀察主機的網路傳輸頻寬應該要大於 1Gbps。
如果沒有,表示沒有頻寬聚合效果,檢查 Switch 是否有設定 Load-Balance policy 為 src-ip;如果還是沒作用,試試不同的 policy。
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |