本文詳述了在Redhat Linux 8.0 下將服務(wù)器的雙千兆網(wǎng)卡接口通過bonding技術(shù)綁定成對外具有一個IP地址的虛擬網(wǎng)絡(luò)接口,以保證網(wǎng)絡(luò)傳輸?shù)母呖捎谩?
1. 編輯 /etc/modules.conf 文件,加入如下一行內(nèi)容,以使系統(tǒng)在啟動時加載bonding模塊,對外虛擬網(wǎng)絡(luò)接口設(shè)備為 bond0
alias bond0 bonding 2. 編輯虛擬網(wǎng)絡(luò)接口配置文件,指定網(wǎng)卡IP vi /etc/sysconfig/ network-scripts/ ifcfg-bond0 DEVICE=bond0 IPADDR=11.0.0.1 NETMASK=255.0.0.0 NETWORK=192.168.1.0 BROADCAST=192.168.1.255 ONBOOT=yes BOOTPROTO=none USERCTL=no 3. 編輯物理網(wǎng)絡(luò)接口配置文件,并指向虛擬網(wǎng)絡(luò)接口bond0.
物理網(wǎng)絡(luò)接口配置文件位于/etc/sysconfig/network-scripts, ifcfg-eth0對應(yīng)第一個千兆網(wǎng)口,ifcfg-eth1對應(yīng)第二個千兆網(wǎng)口。 Ifcfg-eth0 : DEVICE=eth0 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none Ifcfg-eth1 :
DEVICE=eth0 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none 4. 重啟網(wǎng)絡(luò)服務(wù)以使配置生效:
/etc/init.d/network restart 5. 執(zhí)行ifconfig –a 驗證網(wǎng)卡的配置信息. 可以看到,在當(dāng)前的網(wǎng)絡(luò)配置信息中,工作ip(192.168.1.1)被綁定到虛擬出的網(wǎng)絡(luò)接口bond0上。物理上的兩個網(wǎng)絡(luò)接口eth0,eth1的狀態(tài)為slave,由于在配置參數(shù)設(shè)置中options bond0 miimon=100 mode=1指定工作模式為1,所以兩塊網(wǎng)卡的工作方式是 active,backup方式,即主備的工作方式,mode=0為負載均衡方式.
通過查看/proc/net/bond0/info文件中的信息,可以查看當(dāng)前eth0,eth1中哪一個是active模式。
也可用ifconfig –a查看網(wǎng)絡(luò)接口狀態(tài),備份網(wǎng)卡被加上了NOARP標記 ※ 參考資料:Redhat 8.0技術(shù)文檔boing.txt. |
|