为xen客人专用ip

我在Ubuntu服务器上的Xennetworking工作中遇到了一个棘手的问题。 我们的服务器有几个公有IP(/ 29),都是通过eth0别名添加的。 例如

  • eth0 – 主要ip
  • eth0:0 – 第一个空闲IP
  • eth0:1 – 第一个免费的IP
  • eth0:2 – 第一个免费的IP
  • eth0:3 – 第一个免费的IP

这些IP通过/etc/network/interfaces添加如下(为了安全起见,IP被删除):

 auto eth0 iface eth0 inet static address ##.##.##.106 netmask 255.255.255.248 network ##.##.##.104 broadcast ##.##.##.111 gateway ##.##.##.105 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 8.8.8.8 8.8.4.4 dns-search mydomain.com auto eth0:1 iface eth0:1 inet static address ##.##.##.108 netmask 255.255.255.248 network ##.##.##.104 broadcast ##.##.##.111 gateway ##.##.##.105 

如何将eth0:1公开给虚拟机? (这将是专用于该虚拟机。)目前我正在与光伏指令在这里工作 。

首先, 使用桥接 。 如果你按照你的链接,你应该已经桥接设置。

其次,为每个domU内的VM分配IP地址, 而不是在dom0内。 使用网桥时,dom0应该只configuration自己的IP地址。

而不是 (在主机上):

 auto eth0 iface eth0 inet static address ##.##.##.106 netmask 255.255.255.248 network ##.##.##.104 broadcast ##.##.##.111 gateway ##.##.##.105 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 8.8.8.8 8.8.4.4 dns-search mydomain.com 

使用:

 auto xenbr0 iface xenbr0 inet static bridge-ports eth0 address ##.##.##.106 netmask 255.255.255.248 network ##.##.##.104 broadcast ##.##.##.111 gateway ##.##.##.105 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 8.8.8.8 8.8.4.4 dns-search mydomain.com 

一些进一步的参考: XenNetworking

在客人中,您只需像在“单个”机器上那样定义静态IP即可。