0

I have the next scenario:

  • Laptop with Windows 8.1 and static IP address (192.168.0.166)
  • Inside Windows, an Ubuntu Server 15.10 installed in virtual machine with VirtualBox, also with a static IP address (192.168.0.10). The VirtualBox network configuration is in bridge mode.

I've have SSH access to the virtual server from the host machine. The virtual web server, configured with Apache, it's also reachable from the host machine putting the IP address into the browser. But only because I'm in the same network.

If I try to access either of the static IP's from outside the network, it's not working.

So, I would like to access to the virtual server IP from the Internet (I've a domain and I'd like it to redirect to this IP).

I've tried several answers searching through interent, but I'm not able to accomplish my objective. I've come to think that por redirection is the solution, but I don't know how to apply it.

Could I access directly to the virtual server static IP or should I access to the host machine static IP? What do I need to do?!!

3

There are two ways to approach this, depending on how you've configured networking for the VM. either way, you have to port forward on the router to internal somewhere.

If your networking is set up to be 'NAT', then you set up Port Forwarding on your network at the border router to point to your host machine/computer. You then edit the VirtualBox networking of NAT to add port forwards where necessary.

If your networking is set up to be 'Bridged Network', then you set up Port Forwarding on your network at the border router to point to the IP address assigned to your VM by the router.

Several concerns. Security concerns are bold, other ones are italic.

  • Port-forwarding Port 22 is not the best thing to do - you will have brute-forcers and other attacks trying to breach the machine.
  • Not all ISPs permit you to run web servers. You may have blocks put in place for this going forward.
  • Your router may actually listen on port 80 or 443 for administration connections. This means your router is using those ports and you won't be permitted to use them. Also means you may be exposing your router administration ports to the net which is even worse.
  • You will not be able to use any URL or hostname from the Outside to connect to your system, without getting additional things from Dynamic DNS providers, and doing proper configuration. You will need to set up Dynamic DNS on your router with a dynamic DNS service to provide a domain name that 'updates' based on your router's current IP address (or other equivalent discovery system), and then the internet would be able to reach your site (provided port forwarding is done correctly, and your web server on the VM is configured correctly.)
  • Thanks for the detailed explanation! I was doing it correctly but it wasn't working. Your advice about not all ISPs permiting to run web servers was useful, I've contacted my ISP, it seems they block all ports, hope they allow me after asking for permission! – daniegarcia254 Nov 26 '15 at 21:58
  • Finally was all about my ISP blocking the HTTP port. After that, I had some problemas, but related with the Windows firewall. I'd like to remind and highlight that: remember to check your Windows firewall inbound rules!!! – daniegarcia254 Nov 30 '15 at 23:41
0

If you want to access your server (virtual or otherwise) from outside your local network, you setup your router with the appropriate port forwarding... In your router set ports 22 (SSH), 80 (HTTP), and 443 (HTTPS) to forward to 192.168.0.10, but setting 22 to port forward in is a serious security risk. The "Internet" does not comprehend and cannot talk directly to your internal LAN, only your public IP address, so you would have to register your domain to your public IP address, not the 192.168.x.x address, and manage the forwarding of the proper services yourself. Remember that in doing this you should use a DDNS registration of you get your public IP address via DHCP, or you should have a static public IP address if you want to do a standard domain name registration.

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.