0

I've been trying to create a webserver and an email server on my Virtual Machine (Virtual Box) running Ubuntu 20.04 LTS. It all works wonderfully on my local network, but whenever I try to use my email server or visit my webpages it can't connect me to the servers.

I've already set up my Virtual Box as a Bridged Adapter, setup the correct settings on my router.

I've tried the same configurations on my host computer and I can access it from outside of my network.

The reason I want to have both of this servers in a Virtual Machine is because I will use the host computer to run windows and manage other stuff through there.

I could also buy another computer and use that as the servers, but I wanted to spend as little money as possible.

EDIT

I had setup a DMZ host and then was setting port forwarding. When I first set this up I didn't have a clue about what it was, but it worked so I didn't change it. Now I went searching and found out I was being stupid.

I removed DMZ host and now I'm using just port forwarding. It works with OpenVPN, forwarded port 1194 to my physical machine's IP.

My webserver is installed on the virtual machine. I've forwarded it to my VM's IP. When I try to access the webserver via domain name, inside my local network it works fine.

When I try the same remotely it doesn't work. I've then tried to access by my public IP and it worked.

I thought it was the firewall, but I allowed both port 80 and 443 on my ubuntu webserver and it still didn't work (searching for domain name).

3
  • 1
    Generally it works. The router lists the VM with its own IP and other local network hosts can access all services of it with that local IP? And then you set up port forwarding for all required ports to that IP but remote requests this fail? A few more details about what exactly you configured might help, probably focusing on easy to test HTTP for now, if that is part of the services.
    – MichaIng
    Commented Nov 23, 2020 at 11:21
  • I've edited the question with what I've tried so far and what I found I was doing wrong. Commented Nov 23, 2020 at 12:18
  • So you can connect to it publicly using your WAN IP? If that works, then its a matter of getting a domain linked to your IP (ping your hostname publicly and check that its the same IP its trying to ping). It might take a while for DNS servers to correctly update your domain to your IP if you haven't set it up yet.
    – QuickishFM
    Commented Nov 23, 2020 at 21:12

2 Answers 2

0

If you connect it as a bridged network (and not NAT) then each VM should be assigned an IP address from your router and be accessible through your home network as if they were physical computers. This you have set up correctly - so I believe the issue could be with firewalls. make sure you configure firewalls in the VMs to allow traffic from WANs as well as LANs as well as the programs themselves (such that they allow and therefore expect WAN traffic) - and maybe your router will also need configuring for this. Lastly you'd need to forward the necessary ports (if allowed by your ISP - i know some ISPs don't allow you to forward email ports) but it seems this works on your physical PC so I think this should be fine. Just change the port forward rules from your PC to the virtual machine IP address and after configuring firewalls it should hopefully work.

1
  • I've edited the question with what I've tried so far and what I found I was doing wrong. Commented Nov 23, 2020 at 12:18
0

Thanks for everyone who posted their answer, but what I was doing wrong was in fact having the DMZ Host setup. When I disabled the DMZ host, it took a while before I was able to access my webserver via domain name but eventually I could, don't really know why that took so long, I had the domain pointing to my public IP already. But it worked at the end. I haven't tried the email server though, but I recon it will work as long as I forward the ports to the correct IP.

Thanks once again friends.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .