Welcome! Log In Create A New Profile

Advanced

DNS name resolution

Posted by truehl 
truehl
DNS name resolution
November 15, 2010 10:28AM
Hi all,
maybe a stupid question, but could someone please explain, how dockstar does the DNS-Name resolution? As I see, the local dns-server must be resolved by DHCP an added to the /etc/resolv.conf. How does the work? As I can also see, the resolvconf package is not installed!

Thy a lot,
Greetings,

Thomas
Re: DNS name resolution
November 15, 2010 11:35AM
There are no stupid questions, only questions that reflect a lack of knowledge of Debian. And of course there are rude people who answer questions....

The package resolvconf isn't needed to do name resolution on any Unix variant (i.e. it's not just a Debian thing, and it's not just a Linux thing). /etc/resolv.conf is a long-standing standard used by various low-level library calls, such as gethostbyname() and gethostbyaddr(). The system calls know to look in /etc/resolv.conf to figure out what IP address they should connect to for DNS queries. They then send a UDP message to the DNS server with their lookup, and the server responds with the appropriate answer.

The DHCP server gets involved because whoever runs that server configured it to feed clients not only the IP address they should use, but also the network they're on and the DNS server's IP address or addresses. The DHCP client on your machine then dynamically creates the /etc/resolv.conf file based on the information received from the DHCP server. At that point, the Linux libraries can use that file to make DNS queries.
truehl
Re: DNS name resolution
November 15, 2010 02:51PM
Hi ayrlander,
thx for the answer. If I got you right, there is no need for the resolvconf package. My problem is, that I made an system image of a debian-system build with Jeff's method. If people download an install this images on there machines, DNS resolution does not work. That's because a hard coded DNS-Server (mine got at setup time 192.168.2.1) stands in /etc/resolv.conf. If they delete this entry and boot with DHCP again, the entry is not rewritten, it's still empty. For that reason I've installed the resolveconf package, and now the DNS-Server will be rewritten. For people who don't use DHCP they have to make an manual entry for the DNS-Server. I recommend them to do that in the /etc/network/interfaces file. Is that the right way?

Greetings,
Thomas
Re: DNS name resolution
November 15, 2010 03:03PM
It's strange that DHCP wouldn't overwrite /etc/resolv.conf for others automatically. I thought that it normally does; it makes me wonder if that's a configuration option that isn't enabled by default.

Anyway, take a look at this link in Debian's wiki page; at the end of that section, they say how to add the entry to /etc/network/interfaces, so I would presume that's "a" right way (with Linux, there's rarely "the" right way to do something).

Another way is to scroll down further in the wiki page to "DHCP Client Configuration"; there it describes where in the client's DHCP configuration to add DNS lines, if you want to overwrite what the server provides (or, in this case, doesn't provide).

If you don't use DHCP, the easiest method would be to remove the resolvconf package and edit /etc/resolv.conf by hand. That has the advantage of being dynamic; you can edit the file, and you don't need to restart networking or reboot, it should just work and use the new IP for the DNS server you added. To answer your first question, yes, resolvconf is optional (that's also mentioned in the Debian wiki I linked). It's primarily used for services that need to bounce around between different networks regularly. A static host that won't move anywhere shouldn't need it.

Sometimes, though, with Linux, if it works for you, then don't tinker and break it. :-)

(I looked a little further at the wiki; it says that if you have resolvconf installed, then do NOT tweak resolv.conf; that could be part of the problem you're seeing.)
truehl
Re: DNS name resolution
November 17, 2010 12:51PM
Hi Ayrlander,
yes it's strange, I haven't seen it on SheevaPlugs with Debian. They update the resolc.conf by DHCP. The Dockstar image does not do this automatically if the DNS-Server from DHCP changes. Could someone confirm this behavior?

Greetings,
Thomas
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: