-1

I have a domain www.example.com that is hosted externally, with a subdomain data.example.com that is pointing to a local NAS—a Synology DS1815+—(192.168.10.8) that is sitting behind a router (192.168.10.1).

When accessing the subdomain data.example.com from outside my LAN, it is correctly accessible. The A record of the www.example.com pointing to my NAS for the subdomain data.example.com. I opened the corresponding ports 5000, 5001 and 80 on the router to access from outside the LAN.

My problem arises when inside the LAN. When inside on my Lan I can access the NAS through 192.168.10.8:5001. Pointing the browser towards data.example.com does not allow me to access the NAT however.

I installed a DNS server on the NAT for local name resolution. On the LAN, when using nslookup I receive the following with aterm.me (192.168.10.1) being the router and 192.168.10.8 being the NAS where the DNS server is installed.

C:\WINDOWS\system32>nslookup -type=soa data.example.com  
Server:  dns.example.com
Address:  192.168.10.1

data.example.com
primary name server = ns.data.example.com
responsible mail addr = mail.data.example.com

serial  = 1  
refresh = 43200 (12 hours)  
retry   = 180 (3 mins)  
expire  = 1209600 (14 days)  
default TTL = 10800 (3 hours)  
data.example.com
nameserver = ns.data.example.com
ns.data.example.com
internet address = 192.168.10.8

Setting on the router is: I disabled DNS on the router instead pointing the router to 192.168.10.8, the NAS where my DNS server sits. There is also a DNS routing table on the router which I (maybe wrongly) point to 192.168.10.8 for data.example.com.

The Settings on the DNS server have a forward Zone with points to data.example.com.

  • What's hosting the DNS on your Local network? – Tim_Stewart Feb 11 '18 at 3:52
  • 1
    It’s unlikely it’s a DNS resolution issue from your description. It sounds like you are having an issue with hairpin NAT on your router. Your local DNS should have an A record for the NAS that points to the private IP address of the NAS. In other words, your public IP should exist in the public DNS A record, and the private IP address should exist in the private DNS server A record. When internal, use the internal IP. – Appleoddity Feb 11 '18 at 3:55
  • @Tim_Stewart The DNS is on my NAS which I can correctly access by typing in its local IP address on the Browser. using the subdomain however I cannot access the NAS. – ram1411 Feb 11 '18 at 4:54
  • @Appleoddity Thanks for this, I set up a master zone as a Forwarding Zone on the DNS using the subdomain name data.abc.com and the Master DNS local IP address as 192.168.10.8 which is the IP of the NAS. I can access it using the IP address, but not data.abc.com domain. – ram1411 Feb 11 '18 at 4:58
  • @Appleoddity on the Router set up DNS forwarding for data.abc.com to 192.168.0.8 which is the IP of the NAS – ram1411 Feb 11 '18 at 5:06
-2

I want to break this down as simply as possible, hopefully.

We need to clarify some terms and how the technology works.

You say you have a domain, www.example.com hosted externally, with a sub domain data.example.com. But this is not a proper description of what you have. What you actually have is a domain, example.com that is registered with a domain registrar and a hosting company is hosting the domain records (DNS) for the example.com domain. On those DNS servers you have an A record (www.example.com) that points to the IP address of what is likely a website your hosting provider is hosting for you.

Now, I think where the confusion here is that you are calling, and treating, data.example.com as a sub domain. But, what you really mean to do is simply treat data.example.com as a host (your NAS). That means there should be another A record setup at your hosting provider for the example.com zone. It should simply say that data.example.com points to the public IP address of your Internet service on premise.

Then, on your router, as you have stated, you have forwarded the necessary ports from your public IP to your internal NAS.

If all you are trying to do is use data.example.com to access your NAS, then in most cases, what I just described is ALL you have to do. Based on the data you provided, you have gone way beyond what is necessary. You appear to have created a sub domain (data.example.com) at your hosting provider. This is wrong. You appear to have tried to create a DNS zone on your NAS’s internal DNS server for data.example.com, this is wrong. You have multiple adjustments to your router DNS settings or on your computer, this is wrong.

Again, if the only goal you are trying to achieve is to type data.abc.com in to a browser and access your NAS, then you must undo all this extra stuff you’ve done.

There is simply one thing you need to do, create an A record in the abc.com zone at your hosting provider for data.abc.com that points to the public IP address assigned to your internet service.

Only sometimes, if you have a more advanced router, do you run in to hairpin NAT issues. In that case, there are some routing adjustments that need to be made, or you can do split-dns where you have the abc.com domain hosted internally and externally. On the internal DNS server you have an A record for the abc.com zone that says data.abc.com points to the private IP address of your NAS. But, this paragraph should be ignored, unless you actually have the issue.

To reiterate again, data.abc.com is NOT a sub domain and should not be treated like one. It is simply a host (A record) entry in the abc.com domain, and there is absolutely no need for any internal DNS servers or any other modifications made to your router’s or computer’s DNS settings other than default.

Under default conditions, your computer uses your router as a DNS forwarder, and your router forwards DNS requests to your ISP and your ISP will forward requests for data.abc.com to your hosting provider. In return, your computer will obtain the public IP address of your on-premise network. If data.abc.com is typed in to your browser, regardless if you are internal or external you will access your NAS via the public IP. Again, sometimes there can be a hairpin NAT issue, but most home routers do not have this issue. You can test for this problem by typing the public IP address in to your browser, when you are internal, and seeing if you can access your NAS, instead of using the private IP address.

  • Thanks so much, this makes it quite a bit clearer and please excuse again for my messy terminology. the reason I have created data.example.com was that I actually host a website on www.example.com, hence as you stated correctly I created a secondary A record pointing to my NAS and opened the necessary ports. All is fine when accessing the NAS from outside when I am not on my LAN with data.example.com but I would like to be able to type data.example.com when I am on my LAN as well, hence the DNS that I installed on the NAS. Currently can only access NAS through typing 192.168.10.8 when on LAN – ram1411 Feb 11 '18 at 6:21
  • @ram1411 Can you type in the public IP address and still access the NAS? – Appleoddity Feb 11 '18 at 6:28
  • When on my LAN I cannot access the NAS using the public IP address on my browser (I can ping it however using the public IP). When outside the LAN I can access the NAS it using the public IP address. – ram1411 Feb 11 '18 at 6:33
  • @ram1411 Then you have a hairpin NAT issue. The easiest thing would be to fix the problem on the router with routing/NAT rules. You didn’t mention the model of your router. The last resort would be to do split-DNS. This means you use the DNS server on your NAS but you will not be hosting a zone named (data.abc.com). You will be hosting abc.com, and you will be duplicating all the records just like on your hosting provider, except you will use an internal IP for the data.abc.com entry. Then with DHCP settings changes you will have your computers use the NAS for DNS. – Appleoddity Feb 11 '18 at 6:39
  • 1
    This is a sincere and thought out answer to a question posed by the original poster who is clearly not understanding how to troubleshoot this on their own and unclear of how to proceed. So that said, this is not an answer. And this question is unaswerable. Please do not encourage endless troubleshooting questions like this by posting an answer. – JakeGould Feb 11 '18 at 16:19

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.