Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu 11.04, I have setup my localhost so I access my sites at

site1.local  
site2.local  

By setting up virtual hosts and adding entries to my hosts file.

I want to test them in IE so I have installed VirtualBox with Windows.

My question is, How can I access site1.local from the virtual machine?

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

Ah, It's as easy as pie.

In your windows Virtual Machine edit your hosts file

c:\WINDOWS\system32\drivers\etc\hosts

And link your virtual hosts to 10.0.2.2, If you are just using localhost then replace

127.0.0.1 localhost with 10.0.2.2 localhost

So my hosts file looks like

10.0.2.2 localhost
10.0.2.2 site1.local
10.0.2.2 site2.local

share|improve this answer
    
The networking mode is NAT. I've seen other articles suggest different methods using bridged. –  onemanarmy Nov 15 '12 at 16:31
    
This worked for me, using Microsoft's IE images, it gave me a file permission message when I tried to save the host file changes in notebook. If that happens, just right click the notepad program and run as administrator, then open the hosts file within that, that made it work. –  Brad Jul 22 '13 at 19:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.