3

I'm trying to figure out why running dhclient on my interface sets /etc/resolv conf to the ip number of my gateway(router).

This entry is invalid and each and every time causes inability to resolve any address.

I would like to:

  • stop dhclient from overwriting the /etc/resolv.conf or
  • make dhclient write there the valid dns ip from my router

More on the environment: I'm using virtual Debian Wheezy as a client system on Windows Seven x64. It is run by Virtualbox with networking mode set to bridged (all packets from debian are injected to my network interface on windows).

If I manually configure the /etc/resolv.conf then everything works fine. Doing this on every boot is quite annoying..

PS> I know I can write a script to do it for me, but this is not the solution I want. //edit

  • router ip: 192.168.1.100
  • /etc/resolv.conf AFTER running dhclient eth0: "nameserver 192.168.1.100"
  • what I would like the /etc/resolv.conf to look like: "nameserver 89.202.xxxx" (I don't have to provide the real ip do I? )

All other devices - laptop with Ubuntu, two phones with Android, laptop with Windows 7 are able to obtain correct DNS entries from the route

6
  • Why do you think this is what really happens? I have many devices connected to this router and ONLY debian has issues with it. All other devices - laptop with Ubuntu, two phones with Android, laptop with Windows 7 are able to obtain correct DNS entries from the router!
    – kubal5003
    Commented Nov 19, 2012 at 8:12
  • I would like to know why this is happening. Today I'll try to do tcpdump and find out what my router sends. Static dns entry in my config is not what I want in the end..
    – kubal5003
    Commented Nov 19, 2012 at 12:26
  • I haven't done this. I'm going to do that today. I don't expect dhclient.conf to contain anything special since no one has ever altered it and this ip number is quite unique.
    – kubal5003
    Commented Nov 19, 2012 at 14:06
  • I found out that my router is causing the problem - it sends its own ip as dns server. I'm thinking now that this configuration might be ok if all other devices are running good and the problem lies somewhere else..
    – kubal5003
    Commented Nov 19, 2012 at 16:50
  • I'd rather create a new question, because this one is completely valid and the answer is also valid.
    – kubal5003
    Commented Nov 20, 2012 at 11:34

2 Answers 2

3

Well the best approach would be to fix the dhcp server on your router, so it provides you with the correct setting...

If your cannot or do not want to do that you can adjust the dhclient configuration so it does not request dns servers via DHCP.

The configuration file for most distributions will probably be /etc/dhcp/dhclient.conf. In this file you'll find a line similar to this:

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers,
        dhcp6.domain-search, dhcp6.fqdn,
        dhcp6.name-servers, dhcp6.sntp-servers;

Remove domain-name-server (and maybe domain-search) from this list and restart your dhclient process....

1
  • Thanks! That's definitely a good way to cope with this issue. Nevertheless I'm still wondering why this is set to the wrong value..
    – kubal5003
    Commented Nov 19, 2012 at 8:17
1

user "rbtux" is right. But there're special (commented) row in /etc/dhcp/dhclient.conf before suggested:

#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers,
        dhcp6.domain-search, dhcp6.fqdn,
        dhcp6.name-servers, dhcp6.sntp-servers;

I have uncommented it & it work for me.

sry for my Eng.

4
  • 1
    thats a valid option if you run a local dns resolver (such as dnsmasq) Commented Nov 20, 2012 at 21:07
  • agree. I use bind9.
    – Artsiomius
    Commented Nov 21, 2012 at 3:47
  • but you can change prepend domain-name-servers 127.0.0.1 to prepend domain-name-servers xxx.xxx.xxx.xxx
    – Artsiomius
    Commented Nov 21, 2012 at 4:02
  • yes of course... there are several possibilities... Commented Nov 21, 2012 at 4:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .