我有一个专用服务器,我想在使用KVM时运行一些虚拟机。
我正在尝试建立桥接网络,以便可以使用专用IP从外部访问虚拟机。
我尝试使用this article执行此操作,但是一旦我调出br0,我就失去了通过ssh连接到我的服务器(以及其他任何事情)。
这是我的/ etc / network / interfaces:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 66.147.230.23
netmask 255.255.255.0
network 66.147.230.0
broadcast 66.147.230.255
gateway 66.147.230.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 208.67.222.222 208.67.220.220
dns-search samgwydir.com
# bridge
auto br0
iface br0 inet static
# address 216.120.250.44
# netmask 255.255.255.0
# network 216.120.250.0
# broadcast 216.120.250.255
# gateway 216.120.250.1
address 192.168.1.1
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
bridge_ports eth0
bridge_stp off
bridge_fd 0
我已经注释了一个失败的设置,它使用了专用的IP,而是尝试使用本地IP无效。
答案 0 :(得分:1)
不要配置eth0
,因为eth0
是网桥设备(具有IP 192.168.1.1
):
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet manual
# bridge
auto br0
iface br0 inet static
address 192.168.1.1
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
bridge_ports eth0
bridge_stp off
bridge_fd 0
如果您希望主机为多宿主,您可以为br0
分配多个IP地址