
我正在運行 Lenny Xen dom0,在路由 IP 設定中託管多個虛擬機器。為了獲得額外的私有子網,我使用以下命令在 dom0 中建立了網橋 xenbr0:
brctl addbr xenbr0
ifconfig xenbr0 10.0.0.1 netmask 255.255.255.0
ifconfig xenbr0 up
這按預期工作,並且 domU 介面在 VM 啟動時由 Xen 新增至網橋。我唯一的問題是:我到底如何在 /etc/network/interfaces 中指定此配置,使其保持永久並且重新啟動後網橋可用?我嘗試了在許多教程中找到的以下配置:
auto xenbr0
iface xenbr0 inet static
address 10.0.0.1
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
bridge_stp no
我收到兩個不同的錯誤,這取決於橋是否已經存在。如果不存在:
root@dom0:~# brctl show
bridge name bridge id STP enabled interfaces
root@dom0:~# /etc/init.d/networking restart
Reconfiguring network interfaces...if-up.d/mountnfs[eth0]: waiting for interface xenbr0 before doing NFS mounts (warning).
SIOCSIFADDR: No such device
xenbr0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRDADDR: No such device
xenbr0: ERROR while getting interface flags: No such device
xenbr0: ERROR while getting interface flags: No such device
Failed to bring up xenbr0.
done.
如果存在:
root@dom0:~# brctl show
bridge name bridge id STP enabled interfaces
xenbr0 8000.000000000000 no
root@dom0:~# /etc/init.d/networking restart
Reconfiguring network interfaces...if-up.d/mountnfs[eth0]: waiting for interface xenbr0 before doing NFS mounts (warning).
RTNETLINK answers: File exists
Failed to bring up xenbr0.
done.
有人能指出我正確的方向嗎?手動建立時橋工作正常,我只需要正確的設定檔條目。我發現的大多數教程都會在配置中將一些設備添加到網橋中,這可能是它無法工作的問題嗎?我沒有任何想要在創建時添加到橋的接口,因為它們稍後會在虛擬機啟動時添加...
謝謝,馬蒂亞斯
答案1
你似乎錯過了最重要的一行:
auto xenbr0
iface xenbr0 inet static
bridge_ports eth0 eth4 eth7 # bridge traffic between these interfaces
bridge_stp no
address 10.0.0.1
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
man
說:如果您需要更靈活地指定接口,您可以使用以下語法(在 Xen dom0 上最有用):
bridge_ports regex (eth|vif).*
這意味著評估(如在egrep(1) 中)“regex”後面的表達式。
答案2
啟動後運行的腳本來執行您想要的命令怎麼樣?
答案3
您可能需要刪除該network-manager
套件。它經常乾擾手動界面設定。