Domain to VirtualBox Ubuntu Sever

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Solutions Developer
Posts: 1
Joined: 26. Mar 2022, 19:13

Domain to VirtualBox Ubuntu Sever

Post by Solutions Developer »

Good day,

I am trying to forward a domain name to an ubuntu instance in VirtualBox.

The domain is forwarded to the router IP address using A record, this works fine when checked.
The router IP xx.xx.xx.xx is forwarded the computer IP 192.168.y.y
The computer IP 192.168.y.y is forwarded to the virtualbox instance IP 192.168.z.z

Last step was created using netsh command in Windows, when using netsh interface to check it show that it is correctly configured.
In the virtual machine instance, I am using both host-only adaptor and NAT, this enables access to the server from the local computer and gives access to the internet.

I am using Windows 10 for host system and Ubuntu 18.0.4 for the virtual server with Nginx installed.

I can access the Ubuntu server locally without problems. It can access the internet without any problems. When trying to access the domain name the browser replies with "This site can’t be reached".

Now, although everything seems to work fine, but actually it does not.

Anyone who can help what to do?

Thanks a lot.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Domain to VirtualBox Ubuntu Sever

Post by scottgus1 »

The VM needs to be connected though Bridged, see Virtualbox Networks: In Pictures: Bridged Adapter. Then the VM will connect to the LAN directly. You would then forward the port directly to the VM without going through the host IP. So the setup would go like this:
Solutions Developer wrote:The domain is forwarded to the router IP address using A record, this works fine when checked.
The router IP xx.xx.xx.xx is forwarded the computer IP 192.168.y.y
The computer IP 192.168.y.y is forwarded
to the virtualbox instance IP 192.168.z.z
In other words, domain name > public router IP > VM private IP.

Note that if you do forward to the VM's IP address, the VM must have a static IP address to remain connected. Some routers can forward to the network name of the VM OS or the VM's network card MAC address, which are more robust connections.
Solutions Developer wrote:In the virtual machine instance, I am using both host-only adaptor and NAT
If you cannot use Bridged, please post back; there may be another way to do this.
Post Reply