Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have my company network and my home network configured in linux networking, using an alias interface. (pinging IPs works.)

Now in resolv.conf I have

timeout 1

the first representing the company network, the second my private lan.

Being at my company, this works, beeing at home, it does with a huge delay. I have to swap the order of both nameserver entries to get it working without delay. So it looks like there is a timeout in which it tries to access the first nameserver, waits ~3 seconds then goes for the next. Does my timeout 1 not work or can that be shorter?

The problem is the same when I'm at my company's lan with the nameservers swapped like:

timeout 1

How does it work without editing the order of the nameservers?

share|improve this question

closed as off-topic by Sven, mdpc, Scott Pack, Ward, Nathan C Jul 22 '13 at 19:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about hardware or software used in a home setting are off-topic because they require answers that may not be practical for the business and support professionals here. You should try asking on Super User instead." – Sven, mdpc, Scott Pack, Nathan C
If this question can be reworded to fit the rules in the help center, please edit the question.

What exactly doesn't work? –  ALex_hha Jul 21 '13 at 10:04
@ALex_hha beeing in my lan network with the company's nameserver on top I have a ping saying: 3 packets transmitted, 3 recieved, 0% packet loss, time 10107ms. When I ping the IP of that same host it sais the same but 10 times faster ping.. –  DanFromGermany Jul 21 '13 at 10:12
Hmm, in your first post you said that at home it doesn't work at all. And now it seems that it work, but with some delay. How is you home pc is connected with you company network? –  ALex_hha Jul 21 '13 at 10:51
I edited the question. It's not a networking problem (it works fine with ips instead of hostnames). There is some timeout I cannot identify. The same problem is when I'm at my company's network and have my private lan nameserver above the company's one. –  DanFromGermany Jul 21 '13 at 10:55
The easiest way would be in using dhcp server. According to the man page (, timeout should be written with :. timeout: 1 attempts: 1 –  ALex_hha Jul 21 '13 at 11:17

2 Answers 2

up vote 1 down vote accepted

Putting the restriction of not editing the resolv.conf will result in one location always being slower resolving. However, I believe the line you are looking for is

 options timeout:1

There is a package resolvconf that is designed specifically for this situation. It will rewrite your resolv.conf file based on interfaces being up, PPP connections made, and DHCP responses.

share|improve this answer
Ah, I missplaced options timeout: 1 by timeout 1, this in combination with attempts: 1 runs fine. Don't need the package resolvconf package but will have a look at it, thx –  DanFromGermany Jul 21 '13 at 16:06
@DanFromGermany You may want to try rotate in place of attempts:1. Setting attempts: will result in failures if a request gets dropped on the network. –  BillThor Jul 23 '13 at 0:11

That's perfectly normal. Your machine always tries the first nameserver in resolv.conf first. If it isn't reachable (because it doesn't exist in the network you are), it will wait until timeout before trying the second one.

If you want to avoid editing resolv.conf everytime you change your network, the solution depends on the dhcp-configuration of the network and the configuration of your client.

If your DHCP servers are configured to push nameservers when obtaining an IP, you can just tell NetworkManager (or dhcpcd or whatever you use to get your IP) to automatically rewrite your resolv.conf with the nameservers from DHCP. In NetworkManager, you can also manually configure different nameserver configurations for different connections.

share|improve this answer
Can I add a dns server to /etc/network/interfaces ? –  DanFromGermany Jul 21 '13 at 11:36
I accept the other information, thx for answer tho –  DanFromGermany Jul 21 '13 at 16:06
+1 for NetworkManager, which is probably the cleanest solution here. –  Michael Hampton Jul 21 '13 at 18:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.