如何在mac上从vmware访问本地主机?

Jam*_*ris 3 vmware modern.ie

如何在 mac 上从 vmware 访问本地主机?我在 vm ware 中运行现代 IE 图像。我希望能够从 iE 访问本地主机地址。

我的 mac 上的 /etc/hosts 文件中有以下内容:

127.0.0.1 example.example.com
127.0.0.1 beta-example.example.com
Run Code Online (Sandbox Code Playgroud)

我希望能够从 vmware VM 访问 beta-example.example.com。

kap*_*lan 5

更新:我刚刚在我的 IE11 - Win8.1 上从现代知识产权)

我一直在用查尔斯与 macOS 和 Vagrant 一起使用,但是对于 localhost macOS 域,您可以在没有 Charles 的情况下执行此操作。

如果您查看/etc/hosts域的本地文件,它将包含127.0.0.1. 例如,我的有:

# local macOS /etc/hosts
127.0.0.1         workalicious.dev
::1               workalicious.dev
Run Code Online (Sandbox Code Playgroud)

看看你的本地macOS > System Preferences > Network并获取你的 IP 地址,目前我的是10.1.10.146. 在 VM 中以管理员身份运行记事本并打开C:\Windows\System32\drivers\etc\hosts

在虚拟机上的主机文件中,添加您刚从本地 macOS 获得的 IP 地址,并将其与本地主机域一起包含在虚拟机的主机文件中,例如:

# VM's C:\Windows\System32\drivers\etc\hosts
10.1.10.146 workalicious.dev
Run Code Online (Sandbox Code Playgroud)

您应该能够浏览到 VM 上的 localhost 域名,它通过 VM 的主机文件和您的本地 IP 地址链接。对文件进行更改并查看 VM 上的更新。非常适合在 IE 或 VM 上的其他浏览器中进行测试。

(next bit only if you are using a VM with Vagrant, you don't need Charles for localhost domains) Start Charles and allow proxying. Now that you have the local IP in the VM hosts file, open up IE and go to the gear (top right for IE11) select Internet Options > Connections > LAN settings then check the Proxy server and add your local macOS IP to Address: XX.X.XX.XXX with the Port: 4444

Then when you browse to your domain, Charles on the macOS should alert and you can allow, then you should see your local macOS domain on your VM's browser. You can make changes locally and refresh and see the changes on the VM.

唯一令人失望的是查尔斯不是免费的,但值 50 美元。在本地网络中的移动浏览器上执行类似的方法非常有用,而且更简单!

我开始使用 Charles for mobile 然后想我会尝试使用 Vagrant 的 VM,在 IE 中使用代理设置效果很好。