# MISTAKE: "nameserver 0.0.0.0" added to resolv.conf

## VinzC

Hi all.

I've just realized why my laptop has been very slow to show pages or bring up network connections for a long time already. The issue is due to this line in /etc/resolv.conf:

```
nameserver 0.0.0.0
```

I feel dumb because I have exactly no idea why this line comes popping up in that file. Fact is it causes latencies because there's no DNS service listening locally... except when my virtual machine manager and virtual machines are running. But most of the time they're not and that line still pops in.

But even then dnsmasq is never listening to any of my interfaces other than the virtual bridges. Its global configuration file is even empty. It's not even running and is not part of any of OpenRC runlevels.

I suspected my home router (Archer C2) to send buggy DNS options but then I checked and changed the line that said "0.0.0.0" (although it's mentioned "optional") to "1.1.1.1" (just to see what happens). Unfortunately it didn't change anything as to my resolver file.

Although I'm suspecting dhcpcd adds that line to the file I'm actually not sure it does directly update the file and not one of its hooks or a hidden, unsuspected resolver. As for resolvers I have none that I consciously installed (i.e. openresolv). I don't have any VPN either.

Anyway everytime I force dhcpcd to renew its leases (dhcpcd -N) the spurious nameserver line comes back.

Here's dhcpcd configuration file

```
hostname

duid

persistent

option rapid_commit

option domain_name_servers, domain_name, domain_search, host_name

option classless_static_routes

option interface_mtu

require dhcp_server_identifier

slaac private
```

And here are the installed hooks, which, I believe are the defaults for I never did anything with them:

```
total 12

-r--r--r-- 1 root root 2791 17 jun 21:28 10-wpa_supplicant

-r--r--r-- 1 root root  867 17 jun 21:28 15-timezone

-r--r--r-- 1 root root  796 17 jun 21:28 29-lookup-hostname
```

Can anyone help me track this issue down for a fix?

Thanks a lot in advance.

----------

## eccerr0r

I would still think it is coming from your dhcp server, but since you seem to have proved it otherwise, well, that can't be it.

Actually if it was coming from your DHCP server, all machines would also get the errant DNS entry - is this the case?

Looks like your dhcpcd.conf is pretty much stock...so that should be okay...

----------

## Anon-E-moose

you could try setting

nohook resolv.conf 

in your dhcpcd.conf file to see if it would stop that.

ETA: https://wiki.archlinux.org/index.php/Domain_name_resolution#Modify_the_dhcpcd_Config

ETA2: man 5 dhcpcd.conf will give some help, you can set static dns entries there, if it's what's changing your /etc/resolv.conf

----------

## VinzC

 *eccerr0r wrote:*   

> I would still think it is coming from your dhcp server, but since you seem to have proved it otherwise, well, that can't be it.
> 
> Actually if it was coming from your DHCP server, all machines would also get the errant DNS entry - is this the case?

 

I have apparently installed a resolver on the other machine, which is fixed. So the configuration is pretty static. I might try to change it to a mobile profile... although I'm not sure to fail somwhere... I'll try and report anyway.

 *eccerr0r wrote:*   

> Looks like your dhcpcd.conf is pretty much stock...so that should be okay...

 

That's something worth knowing. At least I'm not yet crazy  :Wink:  .

----------

## VinzC

 *Anon-E-moose wrote:*   

> you could try setting
> 
> nohook resolv.conf 
> 
> in your dhcpcd.conf file to see if it would stop that.

 

Well... of course it stopped adding the line — that's rad... But in the meantime if I leave it that way and change site, I'll lose name service resolution. What is to be deduced from this test?

----------

## VinzC

 *eccerr0r wrote:*   

> I would still think it is coming from your dhcp server, but since you seem to have proved it otherwise, well, that can't be it.

 

 :Embarassed:  Erm... I'm sorry, I think I've edited the wrong page on my router, i.e. the WAN instead of the LAN settings... I *really* feel dumb as I've happened to be much smarter than that. Sometimes...

Okay, I'm trying to update the DHCP settings on the LAN side. I'll report if there's anything new.

EDIT: That was it. Stupid human who configured the router probably missed something, maybe believed it's powered by dnsmasq or something. It's all right now. Will take my pills and go to bed.

Probably call the nurse. I may need one...

----------

## VinzC

Joke apart, it was really tricky nevertheless. I'm no specialist on DHCP options and settings but when I see this:

```
                      +------------------+

Default Domain:       |                  |  (optional)

                      +------------------+

                      +------------------+

DNS Server:           |                  |  (optional)

                      +------------------+

                      +------------------+

Secondary DNS Server: |                  |  (optional)

                      +------------------+

```

and when pressing "save" with nothing in those edit boxes makes those boxes show "0.0.0.0", far from me to believe this would cause issues! I've been having this router (TP-Link / Archer C2 inside) for years and it's only for a couple of months or even weeks that I started to see slowdowns. Maybe dhcpcd ignored those options — because, yes, they are sent with "0.0.0.0" although they're f****g optional!

I've had to edit both DNS lines and put the one and only IP of my router *sighs* . But at least the problem is gone.

----------

## Anon-E-moose

The 0.0.0.0 means for it to auto configure, it I'm not mistaken, at least as far as domain name settings. 

But I'm not sure that's what you really want.

----------

## VinzC

 *Anon-E-moose wrote:*   

> The 0.0.0.0 means for it to auto configure, it I'm not mistaken, at least as far as domain name settings. 
> 
> But I'm not sure that's what you really want.

 

That is indeed what I understood. But that crap obviously sends those "0.0.0.0" out there (though, as I understand, it should not), confusing name resolution on my laptop. Writing nothing brings up those 0.0.0.0 by default so there's no way avoiding them but set both to the same value, although being obvious for the firmware. At least it *should*. Seems not.

Unless I'm deeply mistaken, of course.

Anyway, thanks a lot for helping.

----------

## alamahant

I am aware I am just a noob but maybe there are other daemons setting it?

systemd-resolved

systemd-networkd 

(But I assume you are using openrc..)

resolvconf

Could you manually insert your desired nameserver and then maybe use something like

```

chattr +iu /etc/resolv.conf

```

or some other kind of ACL to prevent it from being over-written?

Would that work?

----------

## Hu

It might work, but it is the wrong solution.  Please do not advise users to use the immutable bit without also warning them about the consequences.

If the DHCP server cannot be trusted to send sane DNS servers, then the clients should be told to ignore the DHCP server's suggested DNS servers.

----------

## alamahant

Hu kindly forgive me.

Maybe you can try to install networkmanager and create a static config.

Something like

nmcli .............. ipv4.dns <> ipv4.method manual

Then disable dhcpcd.

Nobody fools with networkmanager.

It is very precise and always works as it should

Or if it comes from your router maybe disable the dhcp server of your router and install your own dnsmasq or dhcp.

----------

## UberLord

 *alamahant wrote:*   

> Hu kindly forgive me.
> 
> Maybe you can try to install networkmanager and create a static config.
> 
> Something like
> ...

 

1) VinzC already said it was a mistake with his DHCP config.

2) He wants to use DHCP, not a static config. This doesn't help.

3) As he wants DHCP pretty sure manual is way out as well.

4) I won't stop anyone disablig dhcpcd, unsure how that helps with a misconfigured DHCP server, but whatever.

5) *

6) It's only as precise as what the network topology advertises

7) Guessing English is not your first language.

Anyway, 5) * - Nobody fools with networkmanager.

A quick grep of NetworkManager on github shows no hits for INADDR_ANY or 0.0.0.0 with regards to DNS so I'll willing to bet that it's just as susceptable to DHCP config error as the next man.

And as the author of not one but *two* downstream packages NetworkManager purports to support (+), NetworkManager just lies.

(+) https://www.linuxquestions.org/questions/slackware-14/slackware-current-networkmanager-and-dhcpv6-not-working-4175574300/

dhcpcd has supported IPv6 and DHCPv6 since dhcpcd-5, reporter has dhcpcd-6 installed. Also, dhcpcd supported IPv6 before NetworkManager.

To-date, NM still reports the same lying error.

(+) No link, but NM claims to support resolvconf. Support is tenuous at best - basically NM merges what it knows about into one file which it presents to resolvconf.

This infact breaks the very thing resolvconf was designed to support - VPN DNS:

https://roy.marples.name/projects/openresolv

What is amusing is that to date, NM still can't manange a resolv.conf file (or other resolvers) in this way.

NetworkManger sure fools a lot of people but it doesn't fool me. Sure I have an extreme bias, but equally my software neither lies nor presents a view to deliberately break other components.

Guessing that NetworkManager has sure fooled you!

----------

## VinzC

Hi Roy. Nice to read from you  :Cool:  .

 *UberLord wrote:*   

> Guessing that NetworkManager has sure fooled you!

 

Bwahahaha   :Laughing: 

You made my day!

@alamahant:

One of the things I learnt in all those years using Gentoo is to recognize software to trust. And quite frankly dhcpcd is probably one of the most trustworthy tools on this platform — yup, I'm probably biased, too. I like to cut the crap from my platform so no systemd, no network manager. Amongst others.

When you trust your network stack, you don't have to feel the urge to interact with it from your desktop environment: it will do its job and be silent about it when everything is fine. In short: don't fiddle with it unless absolutely necessary. That's what dhcpcd does. You have su or sudo whenever there's a problem — yeah, become a sys admin when there are sys admin responsibilities to endorse, what's wrong with that.

How many times do I have to touch my network configuration? Only when I change to a new, unregistered place... *and* there's no RJ45! It generally takes longer to ask the local network admins for authorizations than setup the network by hand...

This use case is no different: not the tool was the problem. *I* was (at least for buying such a unreliable, cheapo, crappy router).

It's totally flabbergasting to see such a tremendous amount of work for a tool (say: NM), which job is basically to sit there and do absolutely *nothing* that the operating system can't do. It's about adding lines of code, hence bugs, for the sole purpose of having an icon somewhere that just brings nothing of truly added value. No thanks.

Be root when you need to, damn'it  :Wink:  ! That's how you understand and talk to your system.

EDIT: I realize NM developers might take offence on what I said. Well... you'll be fine.

----------

