惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
爱范儿
爱范儿
罗磊的独立博客
V
V2EX
量子位
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
博客园 - 司徒正美
Jina AI
Jina AI
博客园 - 叶小钗
小众软件
小众软件
博客园 - 【当耐特】
Y
Y Combinator Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
美团技术团队
P
Proofpoint News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
有赞技术团队
有赞技术团队
MongoDB | Blog
MongoDB | Blog
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell

木匣子

以 Maildir 方式备份邮件 后疫情之中国行 我的 Covid 经历 创建自签名 SSL 证书 写在 2021 年末 在 macOS 上使用 eGPU 的体验 给 Apollo-Link 打补丁 II 动森二维码生成器:服装类(后篇) 动森二维码生成器:服装类(前篇) 动森二维码生成器 for Aseprite 动森图鉴+开发笔记 给 Apollo-Link 打补丁 「攻略」JetBrains Quest S1E3 「攻略」JetBrains Quest S1E2 「攻略」JetBrains Quest S1E1 助你同时维护多个项目的终端神器:Tmux 中文博客的字体选型 使用 Webpack Loader 加载 Icon Font 映射 写在 2019 年末
Edge 浏览器无法访问 VirtualBox 内的网站
Lingjia · 2019-07-26 · via 木匣子

¶Issue

公司的项目会把 Development 阶段的网站用 Vagrant 管理,托管在 VirtualBox 虚拟机中。虚拟机使用的网络接口是 Host-Only 类型的,只允许主机访问虚拟机,而阻止内网中其它设备访问虚拟机(区别于桥接)。同时方便同一个主机上多个虚拟机之间组网通讯(提供 DHCP)。最近升级了 VirtualBox 到最新版 6.0 ,但遇到了个怪事。所有的浏览器都能正常打开虚拟机中的网站,唯独 Edge 浏览器不行:

issue-preview

访问网址会出现 DNS 错误的页面,并显示如下信息:

There was a temporary DNS error. Try refreshing the page.
Error Code: INET_E_RESOURCE_NOT_FOUND

发生临时 DNS 错误。请尝试刷新页面。
错误代码: INET_E_RESOURCE_NOT_FOUND

¶Solution

经过一番检索,试了好几种方法都没有搞定。最终在这个帖子里找了解决方案:

You can workaround this issue by changing your VirtualBox Host-Only Ethernet Adapter’s *NdisDeviceType to 0 and rebooting. You can find the key in Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\00XX. The downside to this is that now you’ll have an “Unidentified Network” in your Network and Sharing Center. It’s also managed by Windows Firewall now and by default it is in the Public Profile and it can’t be really changed easily.

– Jani L. Oct 4, 2017

如果你有多个 VirtualBox 网络接口,需要找到正确的网络适配器,可以在 Control Panel\All Control Panel Items\Network Connections 目录下右键相应的网络适配器,然后在 Properties > Networking > Configure... > EventsInformation 文本框架找到如下描述:

Driver Management has concluded the process to add Service
VBoxNetAdp for Device Instance ID ROOT\NET\0000 with the following
status: 0.

其中的 ROOT\NET\0000 应与注册表中 {4d36e972-e325-11ce-bfc1-08002be10318}\00XX\DeviceInstanceID 的键值相对应。则 00XX 就是你要修改的那个网络适配器了。

接下来要做的就是将该路径下键名为 *NdisDeviceType 的键值由 1 改为 0,并重启主机即可。

¶How / Why

MSDN 对 *NdisDeviceType 这个键的解释可以在这里找到。简而言之就是 UWP(Universal Windows Platform)程序会检查网络适配器的这个键来判断其是否是一个可以联网的网络接口,然后决定是否使用它。

IE 和其它浏览器不是使用 UWP 框架开发的,所以不受影响。而 Edge 正好躺枪。


本文在以下环境中测试

  • Windows 10 Pro(Version 1803, OS Build 17134.885)
  • Microsoft Edge 42.17134.1.0
  • Version 6.0.10 r132072 (Qt5.6.2)