Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I sometimes use python -m SimpleHTTPServer one liner to serve files from my vms for download to my host. Today i tried to use it inside virtualbox vm that is under NAT network settings - i typed this python one liner in console, then i checked what ip my vm has in knetworkmanager (i use debian with kde on my guest), then on host i tried to connect to that ip on port 8000 but i can't connect...

My guests are often paused, saved, etc... maybe ip should change but something went wrong because guest was saved and then restored? Any ideas what to do with that?

I'm using debian linux guest and debian linux host.

share|improve this question

2 Answers 2

To get the port redirect try the following

VBoxManage setextradata "NAME_OF_VM" "VBoxInternal/Devices/e1000/0/LUN#0/Config/pythonhttp/HostPort" 8080
VBoxManage setextradata "NAME_OF_VM" "VBoxInternal/Devices/e1000/0/LUN#0/Config/pythonhttp/GuestPort" 8000
VBoxManage setextradata "NAME_OF_VM" "VBoxInternal/Devices/e1000/0/LUN#0/Config/pythonhttp/Protocol" TCP

This configuration works is for virtual Intel network cards. For the PCnet try pcnet instead of e1000. And I assume that the port in virtual machine is 8000. Remember to change NAME_OF_VM to the name of your virtual machine!

After this you can access the webserver on the host system via http://localhost:8080/ which will be redirected to the virtual machine with the port 8000.

You can check the configuration with VBoxManage getextradata "NAME_OF_VM" enumerate. To remove the configuration type the command without the values.

VBoxManage setextradata "NAME_OF_VM" "VBoxInternal/Devices/e1000/0/LUN#0/Config/pythonhttp/HostPort"
VBoxManage setextradata "NAME_OF_VM" "VBoxInternal/Devices/e1000/0/LUN#0/Config/pythonhttp/GuestPort"
VBoxManage setextradata "NAME_OF_VM" "VBoxInternal/Devices/e1000/0/LUN#0/Config/pythonhttp/Protocol"
share|improve this answer
doesn't work, i can't connect to localhost on 8080 – Phil Nov 24 '09 at 17:21
Can you post the output from VBoxManage getextradata "NAME_OF_VM" enumerate? Did you set the right Network Interface (Intel or PCnet)? – cwo Nov 25 '09 at 12:28

If your vms are NATed they have a virtual IP in a private network (RFC1918 IP range), so they are not routable and accessible from outside.

In order to make a NAT-ed machine reachable from outside you have to implement a PORT REDIRECT on the virtual gateway, mapping a request on a given port to be redirected to the virtual IP on the given port or another.

This is not a virtualization bound issue, this is how NAT works. So any guide on the topic you'll find on the web will apply.

share|improve this answer

Your Answer


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.