Forward port from guest to host

5,576

The easiest way for me seems to be to use the host's IP address instead of 127.0.0.1. You can obtain this from ipconfig by looking at the default gateway.

If you really want to to do port forwarding, I suggest you take a look at https://stackoverflow.com/a/11535395/2313067. I am not even sure that this works on the loopback interface.

Share:
5,576

Related videos on Youtube

evfwcqcg
Author by

evfwcqcg

Updated on September 18, 2022

Comments

  • evfwcqcg
    evfwcqcg over 1 year

    How can I forward port from Guest (OS on virtual box) to Host (my actual machine)?

    Guest - Windows 7
    Host  - Ubuntu 12.10
    

    On my host, I run a web-server on port 3000.

    I want to be able to open a browser from Guest on url

    http://127.0.0.1:3000
    

    and see my web app which I run on Host. (the reason is I need IE browser to test some stuff).

    In Virtual Box settings, I selected NAT and in Port Forwarding I wrote

    Host IP: 127.0.0.1     Port: 3000 
    Guest IP: 192.168.0.3  Port: 3000
    

    where 192.168.0.3 is IP of my Guest machine which I obtained from ipconfig.

    I thought this should work but now, once I try to run a web-server and Guest is running, I get an error that the port is already in use.

    Actual error

    /home/username/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:526:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)

    Web-server is Webrick (default Rails and Ruby web-server in development mode).

    I tried different combination of host/guest IP's and ports but none of them seems to be working.