I am trying to create a web server on a Virtual Machine. I would be happy even if I could access it with something like http://xxx.xxx.xxx.xxx:[port_no] Everything is installed but the step of facing the outside world presents some problems for me, mainly because I am not behind a router. Here are some details:

Host OS: Ubuntu 12.04 The Host is connected to the world through a static IP (Ethernet), there is no router (it is a PC on a University campus and there is no DHCP). There is no firewall from the University administrators.

Guest VM: Ubuntu 14.04 (no windows environment) on VirtualBox.
When using NAT I can connect to the Internet, but if I understand correctly, a Bridged adapter would mean I need either a new static IP or a to be behind a router. When I enable the Bridged Adapter I get an IP, I am guessing on an adhocLAN, and ofcourse it does not work.

Is there any solution for my problem?

1 Answer 1


Sure, this is definitely possible. You just need to do some port-forwarding settings from your Virtualbox interface.

Go to Settings -> Network -> Port Forwarding. Then, add a new rule. In the host port, add some port which you wish to use, say 1212. In the guest port, add port 80 which is the default for apache.

Start your virtual machine and that's it. Your web-server can now be reached from your host machine as: http://localhost:1212, and from the external world as <Public-IP>:1212.

Screenshot: enter image description here

PS: You don't need to use bridged connection or anything like that. Just keep it at NAT.

  • wow, it worked, so simple and yet so elegant. Thank you.
    – papnikol
    May 21, 2015 at 17:38
  • Happy to help :)
    – shivams
    May 21, 2015 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.