在我的 KVM 主机(Ubuntu 14.04 LTS)中,我想为具有静态 IP 和互联网访问权限的来宾设置一个专用网络。主机位于远程计算机上。我在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
# Local network interface
auto br1
iface br1 inet static
address 10.0.0.1
network 10.0.0.0
netmask 255.255.255.224
broadcast 10.0.0.31
bridge_ports eth1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
# The primary network interface and bridge
auto br0
iface br0 inet static
address xx.xx.xx.xx
gateway xx.xx.xx.xx
netmask 255.255.255.0
network xx.xx.xx.xx
broadcast xx.xx.xx.xx
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
现在,我使用如下命令安装客户端:
virt-install \
--name ubuntu1 \
--ram 256 \
--disk path=/var/kvm/images/ubuntu1.img,size=5 \
--vcpus 1 \
--os-type linux \
--os-variant ubuntutrusty \
--network bridge=virbr0,model=virtio \
--network bridge=br1,model=virtio \
--graphics none \
--console pty,target_type=serial \
--location 'http://us.archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
我将 virbr0 设为主接口,安装成功完成。安装后,我将/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
auto eth0
iface eth0 inet dhcp
# Local network interface
auto eth1
iface eth1 inet static
address 10.0.0.2
network 10.0.0.0
netmask 255.255.255.224
broadcast 10.0.0.31
这样,客人就可以访问互联网virbr0
并br1
在内部专用网络中获取静态 IP。
现在,我的问题是,我可以添加类似的桥梁吗:
# Local network interface with network connection
auto br2
iface br2 inet static
address 10.0.0.33
network 10.0.0.32
netmask 255.255.255.224
broadcast 10.0.0.63
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
这样,客人可以在静态的私有网络中,并且只使用一个接口连接到互联网。
但是,当我用这个重启主机后,两个桥接开启eth0
,一个桥接开启eth1
,主机丢失了。无法使用 ssh 登录。由于主机是远程的,我无法物理访问它。
请帮忙。提前致谢。