Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Virtualbox guest OS - Connect to local network but not internet

I am using VirtualBox in Ubuntu with WindowsXP as the guest OS.

In Ubuntu I have a PHP/MySQL server running as localhost and with the VM network set to bridged I am able to connect to localhost from the VM.

However, I would like to limit the VM Guest to be able to continue connecting to localhost but NOT be able to connect to the internet.

This is a security thing - I don't want to have to install firewalls and virus checkers in the VM just to keep it safe - It is being used as a testing platform and only needs to connect locally.

Does anyone know how to do this? Iv spent time searching, but all I find are articles etc that show how to connect the VM to the internet, exactly the opposite to what I want to do.

like image 564
Max Avatar asked Oct 04 '10 13:10

Max


1 Answers

Okay, so that doesn't exactly do what I needed, but this is:

1) Networking for VM set to 'Host Only' This creates a new adapter called vboxnet0

2) On the command line 'ifconfig vboxnet0' This should give you a bunch of stuff, but in there somewhere is an IP address. Make a note of it.

3) Control Panel->Internet Options->Connections Tab->LAN Settings

Make sure both items in automatic configuration at the top are NOT checked then click 'Use a proxy server for your LAN'

Enter an imaginary address and click 'Advanced'

At the bottom of the next window, in the Exceptions panel, type the address that you got from part 2 (ifconfig vboxnet0)

Click all the okay buttons to get out.

4) In all browsers the Ubuntu localhost can be reached by: http:// [IP from part 2]

Phew! I think that did it. I hope this might help someone else.

M

like image 169
Max Avatar answered Oct 18 '22 05:10

Max