Can't get subdomains to work on Google Compute Engine

Hello folks,

so I’m having a little bit of a problem here.

First, a little bit of info:

Network information:

eksposerwer.pl - the main domain registered at az.pl
35.234.122.118 - the IP address of GCE instance.

System information:
OS: Ubuntu 16.04 LTS
Google Compute Engine



What I’m trying to do here is to host a Virtualmin server for a freelance hosting. The problem is with the DNS I suppose.

At first, I’ve configured the GCE DNS Zone as specified below:

eksposerwer.pl. A 300
35.234.122.118

www.eksposerwer.pl. A 300
35.234.122.118

eksposerwer.pl. NS 21600
ns-cloud-b1.googledomains.com.
ns-cloud-b2.googledomains.com.
ns-cloud-b3.googledomains.com.
ns-cloud-b4.googledomains.com.

eksposerwer.pl. SOA 21600
ns-cloud-b1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300



On the side of my domain registrar, I’ve pointed eksposerwer.pl to:

ns-cloud-b1.googledomains.com.
ns-cloud-b2.googledomains.com.
ns-cloud-b3.googledomains.com.
ns-cloud-b4.googledomains.com.



So, for example, right now if I want to access root directory which is eksposerwer.pl, it works just fine.




The tricky part begins when I’m adding a subserver to the root eksposerwer.pl, for example main.eksposerwer.pl. It just doesn’t work.




Later on I found a workaround for that. In the GCE DNS Zone, I’ve configured a wildcard A record for the *.eksposerwer.pl domain pointing to eksposerwer.pl:





*.eksposerwer.pl A 300
eksposerwer.pl.




…so in the end I’ve got all the existing subdomains to work. But, in that case, if I’ll type anything, for example notexisting.eksposerwer.pl, Apache will redirect me to the first working vhost (which is fine for Apache, I know that, so I’ve created 404 page for a root domain).




But the problem is that I can’t delegate any external domain name on eksposerwer.pl.




In the Virtualmin’s DNS record zone for eksposerwer.pl there are ns1.eksposerwer.pl and ns2.eksposerwer.pl entries, but when I’m pointing my test domain, for example testdomain.com, to ns1.eksposerwer.pl and ns2.eksposerwer.pl, it returns NXDOMAIN.




I’m getting sick of this and I’m begging you guys for help.




Best regards,

Chris