3

How can I access local host from vmware on mac? I have Modern IE image running in vm ware. I want to be able to access localhost address from the iE.

I have the following in my /etc/hosts file on my mac:

127.0.0.1 example.example.com
127.0.0.1 beta-example.example.com

I want to be able to access beta-example.example.com from vmware VM.

James Umeris
  • 599
  • 2
  • 7
  • 15

1 Answers1

5

(update: I just did a test on my IE11 - Win8.1 from modern.ie without Charles running for a local domain and it works. Charles is only needed for me when I'm trying to access a Vagrant VM that has a unique IP)

I've been using Charles with macOS and Vagrant, but you can do this without Charles for localhost macOS domains.

If you look at your local /etc/hosts file for your domains it's going to have the 127.0.0.1. For example, mine has:

# local macOS /etc/hosts
127.0.0.1         workalicious.dev
::1               workalicious.dev

Take a look at your local macOS > System Preferences > Network and grab your IP address, currently mine is 10.1.10.146. In the VM run Notepad as the Administrator and open C:\Windows\System32\drivers\etc\hosts

In that hosts file on the VM add that IP address you just got from the local macOS and include it with your localhost domain in you VM's hosts file, for example:

# VM's C:\Windows\System32\drivers\etc\hosts
10.1.10.146 workalicious.dev

You should be able to browse to your localhost domain name on the VM, it's linked through the VM's hosts file and your local IP address. Make changes to the files and see the updates on the VM. Great for testing in IE or other browsers on the 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.

The only bummer is Charles isn't free, but worth the $50. It's great for doing a similar approach on a mobile browser within the your local network, only easier!

I started using Charles for mobile then thought I'd try for VMs using Vagrant, works great with the Proxy settings in IE.

kaplan
  • 4,109
  • 6
  • 30
  • 35