How can i set the timeout option in resolv.conf

Asked by sefs

As from this ubuntu help page....

http://manpages.ubuntu.com/manpages/dapper/man5/resolv.conf.5.html

I am trying to set the timeout option in resolv.conf

to timeout:3

However the setting is wiped out on each restart of network (/etc/init.d/networking restart) or by rebooting.

Is there a method for setting resolv.conf options to be persistent? Or maybe it is a bug? I am not sure so I posted it in Answers.

Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
sefs
Solved:
Last query:
Last reply:
Revision history for this message
Jonathan Marsden (jmarsden) said :
#1

Your /etc/resolv.conf is being rewritten when
your computer gets information from DHCP that
includes which DNS servers to use. This is
desired and expected. Without it, DHCP has
no way to set up the system to use the DNS
servers that DHCP tells it to use.

The removal of your manually entered option
is just a side-effect.

At least in Ubuntu Intrepid 8.10,
you can avoid this removal by using a
static IP address instead of DHCP,
or else by adding your desired line

  option timeout:3

line to the file

  /etc/resolvconf/resolv.conf.d/tail

This file is empty by default, and is owned by root.

So you could make the desired change with the command

  echo "option timeout:3" | sudo tee -a /etc/resolvconf/resolv.conf.d/tail

in a terminal window. Provide your user password when asked for a
password.

If you prefer, you can just edit that file (as root) in
a text editor, and add the options timeout:3 line to it
that way.

However, please note:

The default DNS resolver timeout is 5, and setting this to 3 is
pretty unlikely to solve any issue you are having with DNS
resolution!

So, it might be useful to tell the community (in this question)
what your real problem is (why you think you need this line),
and to ask for help with solving that issue.

BTW I tested this solution in Ubuntu Intrepid 8.10,
you pointed to a dapper man page which is now very old.
I do not know whether my answer would work in dapper!

Jonathan

Revision history for this message
sefs (sefsinc) said :
#2

Very good explanation. Thank you very much.

Here is why I want to do it....

I have a local lan here, and I have set up a ubuntu 8.04 server for web app development. It has virtualmin installed to ease with the set up of Virtual Servers (read apache virtual servers) without having to mess around with the config files manually. Virtualmin has also installed bind9 so i can access each V.S. setup by a domain name such as thisdomain.lan and that domain.lan. I opted for the .lan extension because mdns/avahi/bonjour uses the .local for itself.

I've imputed the ip address of this machine as a dns entry into my router so it can feed out by dhcp to all the connected workstations that grab dynamic IP addresses.

I have this dns listed first in the router, followed by 2 more dns entries which are the dns entries from my ISP (actually they are the nameservers for openDns). So now my lan systems can use the easy names like thisdomain.lan and thatdomain.lan and they will be resolved by the first dns entry in the router which is the virtualmin machine. If the virutalmin machine cannot find a domain ... say microsoft.com it will pass it onto one of the others.

This setup works well if the virtualmin machine is actually on. But I do not want to have it on when I am not actually doing development work. When I am not I shut it down. So now when I browse the web etc... I have to wait until that first dns times out because it is down and move to the second domain name entry...which from what i read takes 5 + (5*2)/3 seconds? before it moves on to the second dns entry in the router.

This has an annoying feel of waiting to long for domains to resolve. So what I wanted to do is to shorten the dns time out to make the wait a little less annoying at least, so I thought that would be a good way to do it.

What do you think.

Revision history for this message
sefs (sefsinc) said :
#3

P.S. the server is 8.04

The workstations are 8.10 and windows.

Revision history for this message
sefs (sefsinc) said :
#4

Hi again ... just a quick note...

I have only up to /etc/resolvconf

Does this mean i dont have something installed, or should I just create the resolvconf.d directory manually inside there...and in there create the tail file manually.

Thanks.

Revision history for this message
sefs (sefsinc) said :
#5

Quick clarification ... should it be

echo "options timeout:3" | sudo tee -a /etc/resolvconf/resolv.conf.d/tail

instead of

echo "option timeout:3" | sudo tee -a /etc/resolvconf/resolv.conf.d/tail

Revision history for this message
sefs (sefsinc) said :
#6

Just another quick note that I dont have resolvconf package installed from the repos and never did. I do not know if i will need this package?