KVM 客户机无法获取软件包,因此可以通过 ssh 访问

KVM 客户机无法获取软件包,因此可以通过 ssh 访问

我对我的 kvm 设置有点困惑。

我在hetzner.de现在想使用 libvirt 和 kvm 设置虚拟化。我创建了一个桥接器br0,现在它拥有静态服务器 ip(而不是默认接口enp2s0)。将 /29 子网链接到桥接器并为客户机分配静态 ip 一切顺利。现在我可以使用静态 ip 从外部访问它,但无法获取软件包或 ping 名称服务器。因此 ping8.8.8.8工作正常,同时 pinggoogle.com回答:

Temporary failure in name resolution

以下是主机的路线(这里和下文中我将第一个八度替换为 255)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         255.251.246.1   0.0.0.0         UG    0      0        0 br0
255.9.179.64      0.0.0.0         255.255.255.255 UH    0      0        0 br0
255.9.179.65      0.0.0.0         255.255.255.255 UH    0      0        0 br0
255.9.179.66      0.0.0.0         255.255.255.255 UH    0      0        0 br0
255.9.179.67      0.0.0.0         255.255.255.255 UH    0      0        0 br0
255.9.179.68      0.0.0.0         255.255.255.255 UH    0      0        0 br0
255.9.179.69      0.0.0.0         255.255.255.255 UH    0      0        0 br0
255.9.179.70      0.0.0.0         255.255.255.255 UH    0      0        0 br0
255.251.246.0   0.0.0.0         255.255.255.224 U     0      0        0 br0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 bro0

的结果brctl show

bridge name     bridge id               STP enabled     interfaces
br0             8000.448a5b5dd0f1       no              enp2s0
                                                        vnet0
bro0            8000.52540006b883       yes             bro0-nic

ifconfig在主机上:

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 255.251.246.11  netmask 255.255.255.224  broadcast 255.251.246.31
        inet6 255::468a:5bff:fe5d:d0f1  prefixlen 64  scopeid 0x20<link>
        ether 44:8a:5b:5d:d0:f1  txqueuelen 1000  (Ethernet)
        RX packets 51679  bytes 3634682 (3.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 90348  bytes 7395186 (7.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

bro0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:06:b8:83  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 44:8a:5b:5d:d0:f1  txqueuelen 1000  (Ethernet)
        RX packets 104449  bytes 7981272 (7.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 89828  bytes 8144371 (7.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 2  bytes 190 (190.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 190 (190.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 255::fc54:ff:fe94:8198  prefixlen 64  scopeid 0x20<link>
        ether fe:54:00:94:81:98  txqueuelen 1000  (Ethernet)
        RX packets 1172  bytes 110476 (107.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5399  bytes 321838 (314.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ifconfig客人

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    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: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:94:81:98 brd ff:ff:ff:ff:ff:ff
    inet 255.9.179.65 peer 255.251.246.11/32 brd 255.9.179.65 scope global ens2
       valid_lft forever preferred_lft forever
    inet6 255::5054:ff:fe94:8198/64 scope link
       valid_lft forever preferred_lft forever

目前我还没有设置任何类型的防火墙。我想在不受其干扰的情况下测试连接等。现在我想这可能是问题所在。可能是伪装的问题。

非常感谢您的帮助!

干杯,托比

答案1

谢谢@MichaelHampton我成功了。我忘记在 下的客户端中更新名称服务器/etc/resolv.conf。插入主机名称服务器解决了我的问题。

相关内容