views:

129

answers:

2

Hi.

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.

Cheers

M

A: 

Ill answer this myself just in case anyone else wants to know:

In the Windows guest: Control Panel->Internet Options

Select the 'Connection Tab'

Make sure that 'Automatically detect settings' is off

Click 'LAN Settings'

Check 'Use proxy server' and add an IP that does not exist

Click 'Advanced'

Add your localhost IP to the section at the bottom: 'Do not use Proxy server for.....'

Your browsers should still be able to reach localhost for testing, but cannot reach the internet. Since there seems to be no connection Id hope that it works both ways (and I'm happy for someone to point out if that is not correct)

Cheers M

Max
A: 

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

Max