我知道有人到处问这个问题,但对我来说没有答案。在谷歌上搜索了几个小时后,我想不出来了。我有Ubuntu 14服务器,我需要制作很少的虚拟服务器--我想要一些像DigitalOcean中的VPS一样的东西--带有外部IP的虚拟机。
所以我有一个有两个I的Ubuntu服务器,但是只有一个物理网卡。
主机系统只能在主地址198.201.29.211之前访问。
当然,虚拟机的行为应该像正常的物理服务器一样,并且能够连接到主机服务器。
这是我的/etc/组网/接口文件:
# Loopback device:
auto lo
iface lo inet loopback
iface lo inet6 loopback
# device: eth0
auto eth0
iface eth0 inet static
address 198.201.29.211
netmask 255.255.255.192
gateway 198.201.29.193
# default route to access subnet
up route add -net 198.201.29.192 netmask 255.255.255.192 gw 198.201.29.193 eth0
auto eth0:0
iface eth0:0 inet static
address 198.201.29.247
netmask 255.255.255.192
auto eth0:1
iface eth0:0 inet static
address 198.201.29.248
netmask 255.255.255.192
auto eth0:2
iface eth0:0 inet static
address 198.201.29.249
netmask 255.255.255.192每个IP (除了主IP: 198.201.29.211在eth0上)都应该完全附加到适当的虚拟机(在eth0上)。
发布于 2016-04-01 21:59:50
事实证明,正确的配置非常简单。(互联网上有这么多令人困惑的答案)。网络源设置(我使用)应该设置为Host eth0 (Bridge 'br0')。
虚拟机的地址只需要在使用虚拟机的虚拟机中设置,而不需要在主机上设置。
虚拟机/etc/组网/接口如下所示:
auto eth0
iface eth0 inet static
address 198.201.29.248
netmask 255.255.255.192
gateway 198.201.29.211这是我的工作/etc/联网/接口(在主机上):
# Loopback device:
auto lo
iface lo inet loopback
iface lo inet6 loopback
# device: eth0
auto eth0
iface eth0 inet static
address 198.201.29.211
netmask 255.255.255.192
gateway 198.201.29.193
# default route to access subnet
up route add -net 198.201.29.192 netmask 255.255.255.192 gw 198.201.29.193 eth0
auto br0
iface br0 inet static
address 198.201.29.211
netmask 255.255.255.192
gateway 198.201.29.193
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0KVM/Libvirt桥接/路由网络不在新的客户内核上工作:我发现由于我的服务器位于Hertzner,所以我还必须关闭ICMP重定向:
for file in `find /proc/ -iname send_redirects`; do echo 0 > $file; donehttps://serverfault.com/questions/767644
复制相似问题