Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

internet explorer on windows virtual machine is ignoring my hosts file

i'm running xp as a virtual machine on windows7 so that i can check what websites look like in ie 6 & 7 that i am building locally, on the same machine.

internet explorer will not find any page hosted on the loalhost. "Internet Explorer cannot display the webpage." i can put an ip address to another server on my lan, and that works fine, but if it is on the same machine, it refuses.

there is no proxy.

i have turned DNS Client Service on and off lotsa times, no effect.

can anybody help?

EDIT: my virtual machine's hosts file had lines like: 127.0.0.1 mydomain.dev

like image 441
changokun Avatar asked Dec 31 '10 22:12

changokun


People also ask

Why is my hosts file entry being ignored by the browser?

Scroll to the bottom of the first panel to find and click on Network Settings. Near the bottom there is a checkbox marked, "Enable DNS over HTTPS". Unchecking that might solve the problem. Why is my hosts file entry being ignored by the browser?

How do I force a host file?

Click Start, click Run, type Notepad, and then click OK. On the File menu, select Save as, type "hosts" in the File name box, and then save the file to the desktop. Select Start > Run, type %WinDir%\System32\Drivers\Etc, and then select OK. Select the Hosts file, and rename it "Hosts.


2 Answers

thank you, nos and Andrew, you both helped me realize that i wasn't treating the virtual machine as it's own machine. my host file had lines like

127.0.0.1 mydomain.dev

which is perfectly valid, but it points to the virtual machine (where there is no web server sw). this is my first time using virtual machines, and i was just so used to my hosts file using 127.0.0.1 for my dev sites. what i needed was to use the ip address of the windows7 machine (where apache is running) instead:

192.168.1.42 mydomain.dev

i'm sure one of you would have seen my error if i hadn't been so sure of my hosts file. thanks! i hope this helps someone else!

like image 178
changokun Avatar answered Sep 28 '22 07:09

changokun


If you mean localhost as in your Windows 7 machine it sounds like you are not using Bridge networking. That means your virtual machine can get to the outside but cannot see your local 192.168.* subnet.

Do this within your windows 7 in a command prompt

ipconfig /all

And this in your Windows XP

ipconfig /all

You'll probably get something like this on your windows 7 machine

(NIC) 192.168.1.100

Virtual-Box 192.168.10.100

and something like this on your windows xp

(NIC) 192.168.10.101

I suspect that your virtual machine is on a different subnet than your main computers NIC.

All hope isn't lost you can

  • Change your VM network bindings to bridged mode

  • or use the ip address that is in the same subject on your windows 7 machine as your Windows xp and ensure your web server is bound to 0.0.0.0 (all interfaces).

If you are trying to access the web server running on your windows 7 machine as 192.168.1.100 from your windows xp, you'll just change it to 192.168.10.100. Keep in mind I made up all these ip addresses and you'll need to change it to your own.

like image 34
Andrew T Finnell Avatar answered Sep 28 '22 06:09

Andrew T Finnell