如何在Ubuntu 19.04 VirtualBox VM上使用名称解析?

问题描述 投票:-1回答:1

我正在Windows 7主机上使用多个VirtualBox Ubuntu 18.10 / 19.04 VM。在其中之一上的一刹那,名称解析停止工作。与互联网的连接仍在工作。

ax@buildvm:~$ 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=51 time=40.5 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=51 time=35.5 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=51 time=42.4 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=51 time=36.2 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 35.456/38.635/42.408/2.906 ms
ax@buildvm:~$ ping google.com
ping: google.com: Temporary failure in name resolution

如何使名称解析正常工作?


其他信息

ax@buildvm:~$ ip address show
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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:fb:bc:af brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.5/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 947sec preferred_lft 947sec
    inet6 fe80::a00:27ff:fefb:bcaf/64 scope link
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:27:32:88 brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.106/24 brd 192.168.56.255 scope global dynamic enp0s8
       valid_lft 947sec preferred_lft 947sec
    inet6 fe80::a00:27ff:fe27:3288/64 scope link
       valid_lft forever preferred_lft forever
ax@buildvm:~$ cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 127.0.0.53
options edns0
search fritz.box

“

networking virtual-machine virtualbox nat ubuntu-19.04
1个回答
0
投票

This博客文章提供了解决方案:

$ sudo rm /etc/resolv.conf
$ sudo ln -s /var/run/systemd/resolve/resolv.conf /etc/resolv.conf
$ systemctl restart systemd-resolved.service

现在正在工作:

$ ping google.com
PING google.com (216.58.205.238) 56(84) bytes of data.
64 bytes from fra15s24-in-f14.1e100.net (216.58.205.238): icmp_seq=1 ttl=54 time=34.7 ms
64 bytes from fra15s24-in-f14.1e100.net (216.58.205.238): icmp_seq=2 ttl=54 time=34.5 ms
64 bytes from fra15s24-in-f14.1e100.net (216.58.205.238): icmp_seq=3 ttl=54 time=34.6 ms
64 bytes from fra15s24-in-f14.1e100.net (216.58.205.238): icmp_seq=4 ttl=54 time=35.0 ms
© www.soinside.com 2019 - 2024. All rights reserved.