DNS records


I’m a bit confused about DNS records within the DNS service.

I’m running my own DNS server on my home LAN. I also host a website, lets call it mysite.com, it is accessible from the web. Due to the limitation of my ADSL router I can’t access mysite.com from my LAN. So I figured I’d add a Record on my DNS server. In the Zone Editor in the Records tab I added the Record Key mysite.com A: (the internal adres of mysite).

My pc’s all have one DNS server and that would be my DNS server. The DNS servers of my provider are Forwarders.

I would think that when I tried to resolve mysite.com from a client my DNS would tell it that is the place to be, but instead it keeps giving the external (www) address.

To confuse (at least me) even more, if I open the hosts file on my server and I add the line mysite.com it keeps resolving the www address :s

So you think back to your windows time and reboot the server… I was so relieved that this didn’t solve it. I think…

Where did I go wrong?

See it like this: the DNS server does its job, and resolves requests according to the zone files. It does not look at the hosts file.

Your clients within the LAN may add a different entry in their ‘hosts’ file. Then it works, because they will first check the hosts file before they query DNS.

If you want your local servers to give different answers to the LAN and to the outside world then google for ‘split DNS’. This is too complicated to explain here.

No he wasn’t using a hosts file, he does have a local DNS server and he is attempting split DNS. Only it isn’t working for him.

@ricochet: It seems your DNS server isn’t resolving for mysite.com. You have to set up a zone for mysite.com. You cannot just add an A record for mysite.com to your local zone. If you are not answering queries for the zone mysite.com, your server will not do anything about www.mysite.com.

And yes, it means that when you have that zone set up, any query involving mysite.com will go to your server. So any domain names of the form X.mysite.com will be resolved by your server. You cannot have some domain names in mysite.com resolved by you and others by the outside DNS service.

@vodoo: I did a ping from my server and changed the host file on my server. I really thought that my server would first check its host and then the dns if I was working on the console of the server. I understand that the DNS service won’t check the host file if a client makes a request.

@ken_yap: Ok, so do you mean I have to make a zone called mysite.com and thats it? Cause I had a zone, called the same as my local domain name :slight_smile: I’ll try that whilst waiting for your reply.

Both thanks for the replies!

Yes, you have to use a zone file. I don’t know if Yast can do this for you, but it is easy to create one.

Just add the

zone "mysite.com" in {
        type master;
        file "master/mysite.zone";
        notify yes;

Then, you create the file etc. If you use your DNS server as the SOA of the domain, you must define views (one for the world and one for your LAN. There are a lot of examples (I think that howtoforge has some).

Thank you very much!