Ubuntu:无法使用 NAT 连接到主机的互联网连接

标签 ubuntu networking connection virtualbox

我在 Virtualbox 上安装了 Lubuntu。我正在使用 Windows 7 x64。我的虚拟机是 32 位版本。互联网使用桥接适配器工作,但我正在尝试使用 NAT,以便我可以使用 VPN。在 Windows 的网络和共享中心中,我看到连接“VirtualBox Host-Only Connection”并显示“无法访问 Internet”。在属性中,选中“VirtualBox Bridged Networking Driver”。以下是 ifconfig 的输出:

dev@dev-VirtualBox:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:f3:48:24  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fef3:4824/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:379 errors:0 dropped:0 overruns:0 frame:0
          TX packets:421 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:32105 (32.1 KB)  TX bytes:34987 (34.9 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:856 errors:0 dropped:0 overruns:0 frame:0
          TX packets:856 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:56432 (56.4 KB)  TX bytes:56432 (56.4 KB)

路由表:

dev@dev-VirtualBox:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
10.0.2.0        *               255.255.255.0   U     1      0        0 eth0
dev@dev-VirtualBox:~$ 

连接编辑器: 一般:当网络不可用时自动连接到该网络,所有用户都可以连接到该网络 以太网:MTU 自动 IPV4:自动 (DHCP),需要 ipv4 寻址才能完成此连接 IPV6:忽略

dev@dev-VirtualBox:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

最佳答案

事实证明,NetworkManager 没有使用名称服务器更新/etc/resolv.conf。

在/etc/NetworkManager/NetworkManager.conf 中注释掉 dns=dnsmasq 重启后有效。

从这里开始(第一个解决方案对我不起作用) https://askubuntu.com/questions/137037/networkmanager-not-populating-resolv-conf

关于Ubuntu:无法使用 NAT 连接到主机的互联网连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26264087/

相关文章:

java - 简单的 Web 服务器在收到 http 请求时挂起

windows - 以编程方式安装 NDIS 筛选器驱动程序

networking - 网络负载和到达间隔时间

Flutter 如何通过整个应用程序检查互联网连接,而不仅仅是在一个特定的类中,并在丢失时提示弹出对话框?

Python服务器 "Only one usage of each socket address is normally permitted"

ubuntu - hg pull 与多个用户

ruby - 无法在 Ubuntu 中安装 vagrant 插件

mysql - 如何杀死 MySQL 连接

python - 如何在 Ubuntu 上使用 Python 查找 Apache2 的配置错误?

c - 尝试从 valgrind 读取泄漏摘要 - 程序在我的电脑上导致段错误,而不是在另一台电脑上