Debian网桥的configuration – / etc / network / interfaces

我正在运行一个Lenny Xen dom0托pipe路由IP设置中的多个虚拟机。 为了获得一个额外的私有子网,我使用以下命令在dom0中创build了桥xenbr0:

brctl addbr xenbr0 ifconfig xenbr0 10.0.0.1 netmask 255.255.255.0 ifconfig xenbr0 up 

这可以按预期的方式工作,并且在虚拟机启动时由Xen将domU接口添加到网桥。 我唯一的问题是:我怎么在/ etc / network / interfaces中指定这个configuration,它保持永久性,并且在重新启动后这个网桥是可用的? 我尝试了很多教程中的以下configuration:

 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 

我得到2个不同的错误,这取决于桥梁是否已经存在。 如果不存在:

 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. 

有谁能指出我正确的方向吗? 桥手工创build时工作正常,我只需要正确的configuration文件条目。 我发现最多的教程添加一些设备的桥梁在configuration,也许这​​个问题,为什么它不工作? 我没有任何接口,我想添加到创build的桥梁,因为他们后来添加到VM启动…

谢谢,Mathias

你似乎错过了最重要的一行:

 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))在“正则expression式”之后的expression式。

如何启动后运行的脚本来执行你想要的命令?

您可能需要删除networkingpipe理器数据包。 它经常干扰手动界面设置。