您好超级用户,
我正在尝试通过 Libvirt 的默认 NAT 在我的 KVM/QEMU VM 中建立并运行互联网连接。
不幸的是,客户机(Windows 10)将虚拟适配器视为“不明身份的网络”并表明“没有互联网”. 这和输出“ipconfig”(下图)显示虚拟机的 DHCP 无法正常工作。子网掩码(最初255.255.255.0)和自动 IPv4(,应该在192.168.122.2 和 192.168.122.254,) 也配置错误:
Ethernet adapter Ethernet 2:
Connection-specific DNS Suffix . :
Autoconfiguration IPv4 Address. . : 169.254.81.241
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
输出“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: enp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether f0:2f:74:1b:5b:aa brd ff:ff:ff:ff:ff:ff
3: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:5b:92:9a brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether d0:37:45:d8:fb:9a brd ff:ff:ff:ff:ff:ff
inet 192.168.0.127/24 metric 20 brd 192.168.0.255 scope global dynamic wlan0
valid_lft 603733sec preferred_lft 603733sec
inet6 fe80::d237:45ff:fed8:fb9a/64 scope link
valid_lft forever preferred_lft forever
6: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master virbr0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:d4:cd:4e brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fed4:cd4e/64 scope link
valid_lft forever preferred_lft forever
输出“IP 地址”在主机上:
default via 192.168.0.1 dev wlan0 proto dhcp src 192.168.0.127 metric 20
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.127 metric 20
192.168.0.1 dev wlan0 proto dhcp scope link src 192.168.0.127 metric 20
192.168.0.56 dev wlan0 proto dhcp scope link src 192.168.0.127 metric 20
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
这很奇怪,因为这座桥(virbr0)已启动,并且虚拟接口(虚拟网络0)已连接到它。为了修复错误配置,我静态设置了 LAN 设置,这有效,但现在我只能 ping 我的主机(192.168.0.127)和桥(192.168.122.1),但 ping 到 WAN 服务器,例如“google.com”甚至“8.8.8.8”暂停。 这是否意味着 virbr0 工作并按预期转发数据包,但是防火墙不允许虚拟网桥将数据包发送到默认网关?
- nftables 规则 (# nft 列表规则集):http://0x0.st/Ho6G.txt
- virbr0 配置 (/etc/libvirt/qemu/networks/default.xml):http://0x0.st/Ho6h.txt
- Libvirt 日志 (/var/log/libvirt/libvirtd.log):http://0x0.st/Ho6n.txt
- 虚拟机开启时配置 vnet0 (/etc/libvirt/qemu/win10.xml):http://0x0.st/HoIs.txt
这是我已经尝试过的:
- 安装和启用 域名系统(dnsmasq 错误现已消失)
- 系统控制-w网.ipv4.ip_forward=1>> /etc/sysctl.conf
提前感谢您的时间和帮助!
limefrog:)))