Personal tools
You are here: Home weblog Specifying a DNS server under Gentoo linux

Specifying a DNS server under Gentoo linux

Posted by Dominic Cronin at Sep 23, 2007 08:06 PM |


I realised this afternoon that trackback pings from this server weren't reaching their targets. A short investigation showed that I couldn't resolve domain names. For name resolution to work, you need to have a "nameserver"  directive in  /etc/resolv.conf ,  but  there wasn't one there. I remembered that I'd solved the same problem a few months ago by adding such a directive. Obviously I hadn't been thorough enough at the time if it was now broken again. 

The obvious candidate to blame was rebooting the system. I'd rebooted for some reason a few weeks ago; presumably it had been broken since then. This was indeed the case as it turned out. On a Gentoo system the /etc/resolv.conf file is created by the init scripts. These init scripts use data from /etc/conf.d/net. The problem I had was that I didn't know the correct syntax for a directive in this file which would cause resolv.conf to get a nameserver directive.

After much digging, it turned out that:

  1. There is no documentation
  2. There is a file called /etc/conf.d/net.example which contains sufficient detail to allow you to fix the problem
If you add something like this to /etc/conf.d/net :

dns_servers=( "192.168.0.3" )

you'll end up in your /etc/resolv.conf with a line that looks like this:

nameserver 192.168.0.3

Hope this helps


Document Actions

Hi everybody junior to the odds

Avatar Posted by free call international at Feb 17, 2010 08:57 PM
www.dominic.cronin.nl; You saved my day again.

Add comment

You can add a comment by filling out the form below. Plain text formatting.

(Required)
Tell us your name.
(Required)
Enter your e-mail address.
(Required)
(Required)