Linux

如何在 RHEL 6.4 伺服器中配置橋接?

  • December 24, 2013

已安裝系統(rhel-server-6.4-x86_64-dvd.iso)。KVM over which set。主機和來賓機器分配了自己的 IP 地址,為此橋br0配置。一切正常。現在我們必須在綁定上架起一座橋樑。

在主機上進行以下設置:

[root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
HWADDR=f0:92:1c:0f:76:f8
MASTER=bond0
SLAVE=yes
ONBOOT=yes

[root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HWADDR=F0:92:1C:0F:76:FC
MASTER=bond0
SLAVE=yes
ONBOOT=yes

[root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
DEVICE=bond0
ONBOOT=yes
BRIDGE="br0"

[root@server ~]# cat /etc/modprobe.conf 
alias bond0 bonding
options bond0 mode=1 miimon=100

[root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-br0 
DEVICE="br0"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Bridge"
BOOTPROTO="static"
IPADDR="10.2.26.39"
GATEWAY="10.2.26.1"
MTU="1500"
NETMASK="255.255.255.0"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="no"
NAME="System br0"

查看:

[root@server ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: down
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: f0:92:1c:0f:76:f8
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f0:92:1c:0f:76:fc
Slave queue ID: 0

eth0被關閉了。雖然我期待看到如下內容:

[root@server ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f0:92:1c:0f:d5:e8
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: f0:92:1c:0f:d5:ec
Slave queue ID: 0

問題本身在一個主題中,如何在 RHEL 6.4 伺服器中配置橋接?

這是正確的配置,但有幾點:

  • alias bond0 bonding你根本不需要
  • 綁定配置應該BONDING_OPTS在 ifcfg-bondX 中,而不是在 modprobe 中
  • 將一個添加DELAY=0到您的網橋,以防止它在界面啟動時等待

eth0 關閉的事實與橋接或綁定無關,請對物理介面進行故障排除。ethtool eth0會告訴你它沒有檢測到連結。

重新安裝電纜,更換電纜,嘗試不同的交換機埠,嘗試不同的 NIC。

引用自:https://serverfault.com/questions/562136