KVM 中断了我主机的互联网连接

KVM 中断了我主机的互联网连接

当主机第一次启动时,route显示:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.0.1     0.0.0.0         UG    0      0        0 enp3s0
192.168.0.0     0.0.0.0         255.255.0.0     U     0      0        0 enp3s0
192.168.0.1     0.0.0.0         255.255.255.255 UH    0      0        0 enp3s0

ping 8.8.8.8说:

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=55 time=6.40 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=55 time=6.36 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=55 time=6.37 ms

一分钟后(我想是在我的 KVM 客人启动之后?),route说:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         255.255.255.255 UH    0      0        0 macvtap1
0.0.0.0         0.0.0.0         255.255.255.255 UH    0      0        0 macvtap0
0.0.0.0         0.0.0.0         255.255.255.255 UH    0      0        0 macvtap2
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 macvtap1
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 macvtap0
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 enp3s0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 macvtap2
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 macvtap0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 macvtap1
192.168.0.0     0.0.0.0         255.255.0.0     U     0      0        0 enp3s0
192.168.0.1     0.0.0.0         255.255.255.255 UH    0      0        0 enp3s0

ping 8.8.8.8说:

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 169.254.245.85 icmp_seq=1 Destination Host Unreachable
From 169.254.245.85 icmp_seq=2 Destination Host Unreachable
From 169.254.245.85 icmp_seq=3 Destination Host Unreachable

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 noprefixroute
       valid_lft forever preferred_lft forever
2: enp12s0: <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 38:d5:47:aa:6c:b0 brd ff:ff:ff:ff:ff:ff
3: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 38:d5:47:aa:6c:af brd ff:ff:ff:ff:ff:ff
4: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 78:2d:7e:13:f7:d6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.97/16 brd 192.168.255.255 scope global enp3s0
       valid_lft forever preferred_lft forever
    inet6 fe80::7a2d:7eff:fe13:f7d6/64 scope link
       valid_lft forever preferred_lft forever
5: macvtap0@enp3s0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 500
    link/ether 08:00:27:f5:3b:9b brd ff:ff:ff:ff:ff:ff
    inet 169.254.161.146/16 brd 169.254.255.255 scope global macvtap0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fef5:3b9b/64 scope link
       valid_lft forever preferred_lft forever
6: macvtap1@enp3s0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 500
    link/ether 08:00:27:eb:28:3d brd ff:ff:ff:ff:ff:ff
    inet 169.254.245.85/16 brd 169.254.255.255 scope global macvtap1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:feeb:283d/64 scope link
       valid_lft forever preferred_lft forever
7: macvtap2@enp3s0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 500
    link/ether 08:00:27:d7:49:ee brd ff:ff:ff:ff:ff:ff
    inet 169.254.144.158/16 brd 169.254.255.255 scope global macvtap2
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fed7:49ee/64 scope link
       valid_lft forever preferred_lft forever

cat /etc/network/interfaces说:

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp3s0
iface enp3s0 inet dhcp

allow-hotplug enp0s31f6
iface enp0s31f6 inet dhcp

我里面什么都没有/etc/network/interfaces.d/。我使用的是 Debian 12。某些 LAN 网络可以工作,但主机没有 Internet 连接。客人可以上网。

我配置了什么错误以及如何修复它?

相关内容