我正在我的 Ubuntu 16.04 服务器上运行带有 virt-manager 的虚拟机,并尝试让客户机与主机进入同一网络。
我尝试过这些方向然而,我最终得到的结果是,它可以 ping 通主机,但不能 ping 通互联网。
主机配置
host$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto enp3s0
#iface enp3s0 inet dhcp
iface enp3s0 inet manual
auto br1
iface br1 inet dhcp
bridge_ports enp3s0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
host$ brctl show
bridge name bridge id STP enabled interfaces
br1 8000.002590606dae no enp3s0
docker0 8000.024255cb1799 no veth12ab6bb
veth132d7f2
veth167e73b
veth3538eea
veth35cae89
veth434db1b
veth794ed99
veth90e96b0
vethc19adf6
vethc2669ae
vethc3b9c37
vethe62f5fe
virbr0 8000.525400263616 yes virbr0-nic
host$ ip address show br1
89: br1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:25:90:60:6d:ae brd ff:ff:ff:ff:ff:ff
inet 192.168.2.42/24 brd 192.168.2.255 scope global br1
valid_lft forever preferred_lft forever
inet6 fe80::225:90ff:fe60:6dae/64 scope link
valid_lft forever preferred_lft forever
host$ ip address show enp3s0
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br1 state UP group default qlen 1000
link/ether 00:25:90:60:6d:ae brd ff:ff:ff:ff:ff:ff
来宾配置
来自/etc/libvirt/qemu/testvm.xml
主机:
<interface type='bridge'>
<mac address='52:54:00:ad:ab:0c'/>
<source bridge='br1'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
在客户机中,ens3
网络接口配置为 DHCP,但未获取 IP 地址。客户机正在使用 netplan。