我正在尝试为 KVM 客户机设置桥接网络。我的客户机操作系统 (Windows 10) 设置为使用 br0,但没有网络连接。我的主机通过 DHCP 获取其 IP 地址(路由器始终为其提供相同的保留 IP)。我希望我的 VM 客户机也通过 DHCP 获取 IP 地址。我做错了什么?我在网上找到的说明对我没有帮助,因为它们没有说明它们假设我正在使用哪些网络子系统,而且网络似乎由 NetworkManager、networkd、netplan 和/或 /etc/network/interfaces 的某种组合管理,其中许多是不兼容且相互冲突的。
以下是一些细节:(我添加了 br0。安装 virtlib 时必须添加 virbr0 和 virbr0-nic)
vmhost:#
vmhost:# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
vmhost:#
vmhost:# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc fq_codel state UP group default qlen 1000
link/ether 3c:52:82:62:df:a8 brd ff:ff:ff:ff:ff:ff
inet 192.170.20.80/24 brd 192.170.20.255 scope global dynamic noprefixroute eno1
valid_lft 85298sec preferred_lft 85298sec
inet6 fe80::2093:3ece:58e4:26cd/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:18:91:70 brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:18:91:70 brd ff:ff:ff:ff:ff:ff
10: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether da:f0:24:4f:23:85 brd ff:ff:ff:ff:ff:ff
vmhost:#
vmhost:# cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
vmhost:#
vmhost:# cat /etc/netplan/vmhost.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
eno1:
dhcp4: no
dhcp6: no
bridges:
br0:
dhcp4: yes
dhcp6: no
interfaces: [ eno1 ]
accept-ra: no
vmhost:#
vmhost:#