如何为Xen创build桥接networking接口?

我想第一次在Ubuntu服务器上使用Xen,并有一个非常基本的问题。

我遵循Ubuntu文档中的指南,并在Network Configuration->Using bridge-utils部分下面说:

接设置中,我们需要将IP地址分配给桥接接口。 configurationnetworking接口,使其在重新启动后保留:

sudo vi / etc / network / interfaces

 auto lo eth0 xenbr0 iface lo inet loopback iface xenbr0 inet dhcp bridge_ports eth0 iface eth0 inet manual 

重新启动networking来启用xenbr0网桥:

 sudo ifdown eth0 && sudo ifup xenbr0 && sudo ifup eth0 

我的/etc/network/interfaces文件:

 # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto em2 iface em2 inet static address 68.65.120.34 netmask 255.255.255.224 network 68.65.120.32 broadcast 68.65.120.63 gateway 68.65.120.33 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 68.65.120.33 8.8.8.8 4.4.2.2 dns-search web-hosting.com 

这是我的尝试,当我尝试它时,导致我失去SSH访问:

 # The loopback network interface auto lo em2 xenbr0 iface lo inet loopback #xen iface xenbr0 inet dhcp bridge_ports em2 # The primary network interface auto em2 iface em2 inet manual address 68.65.120.34 netmask 255.255.255.224 network 68.65.120.32 broadcast 68.65.120.63 gateway 68.65.120.33 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 68.65.120.33 8.8.8.8 4.4.2.2 dns-search web-hosting.com 

然后:

 sudo ifdown em2 && sudo ifup xenbr0 && sudo ifup em2 

我如何修改我的configuration文件的内容来使用Xen?

  • 在你的第一个networkingconfigurationem2被configuration为使用static方法。 在你的第二个它被设置为manual 。 使用manual ,后来设置的选项不会得到应用,因​​此您失去了访问权限。
  • 您的机器通过em2物理连接到networking。 你要创build一个名为xenbr0的桥,所以你需要将em2设置为手动(你做了什么),将xenbr0设置为static (如em2之前,而不是dhcp ),并将所有选项从em2移动到xenbr0
  • 所以,试试这个:

     # The loopback network interface auto lo iface lo inet loopback #xen auto xenbr0 iface xenbr0 inet static address 68.65.120.34 netmask 255.255.255.224 network 68.65.120.32 broadcast 68.65.120.63 gateway 68.65.120.33 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 68.65.120.33 8.8.8.8 4.4.2.2 dns-search web-hosting.com bridge_ports em2 # The primary network interface auto em2 iface em2 inet manual 
  • 还有更多选项可以设置,特别是在虚拟环境中:

      bridge_stp off # disable Spanning Tree Protocol bridge_waitport 0 # no delay before a port becomes available bridge_fd 0 # no forwarding delay