Acces for a Public IP in Apache Server 2 run in Ubuntu Server (guest) mount in a Virtual Box with a Windows 7 Host.

1) Mount a Virtual Machine in Virtual Box 6.1 with an empty versión of Ubuntu Server 16.04, 2GB RAM and one CPU. The host Machine is Windows 7 conected to a router. I’ve a public IP, and configured mi Router vía IP Forwarding and open port 80 for the local IP of my host machine: 192.168.xx.xx.


2) Then in Virtual Box, go to Tools->Preferences -> Network ->Add New NAT Network.

Then Edit this new NAT Netw. -> Name = “NatNetwork”. Then Click in Forward Ports -> IPv 4 -> Rule 1; TCP; Host IP 192.168.xx.x (the local IP of the Host computer); Host Port = 80; Guest IP = 10.0.2.xx (it’s the IP of my guest ubuntu server, what i’m seeing vía $ifconfig from console); Guest Port = 80. Then click in ACEPT.


3) In Virtual Machine (Ubuntu in my case) go to Configuration -> LAN Configuration: Conected to: RedNat; Name = “NatNetwork” (select the Nat Netw. what created in 2).


4) Next i RUN my guest machine (Ubuntu Server 16).


5) In the console i installed Apache2 follow the steps in https://www.digitalocean.com/community/tutorials/como-instalar-linux-apache-mysql-php-lamp-en-ubuntu-16-04-es


6) When apache2 is installed i can view my Apache Server via $ curl 10.0.2.xx (local ip of my guest machine) and the same Apache Server via Chrome in my Host Machine in the local IP 192.168.xx.xx and the same Apache Server in my public IP (because i’ve already configured my router for IP Forwarding).

Thanks to: https://christophermaier.name/2010/09/01/host-only-networking-with-virtualbox/

Dejar un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *