Python simple http server and virtual machines - can't connect. Ip changed?
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"
Related videos on Youtube
Comments
-
Phil over 1 year
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.
-
Phil over 14 yearsdoesn't work, i can't connect to localhost on 8080
-
chrw over 14 yearsCan you post the output from VBoxManage getextradata "NAME_OF_VM" enumerate? Did you set the right Network Interface (Intel or PCnet)?