Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
MISTAKE: "nameserver 0.0.0.0" added to resolv.conf
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5021
Location: Dark side of the mood

PostPosted: Thu Aug 01, 2019 4:05 pm    Post subject: MISTAKE: "nameserver 0.0.0.0" added to resolv.conf Reply with quote

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:
/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
dhcpcd.conf:
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:
ll /usr/share/dhcpcd/hooks/:
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.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!


Last edited by VinzC on Thu Aug 01, 2019 6:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7253
Location: almost Mile High in the USA

PostPosted: Thu Aug 01, 2019 5:30 pm    Post subject: Reply with quote

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...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 4311
Location: Dallas area

PostPosted: Thu Aug 01, 2019 5:54 pm    Post subject: Reply with quote

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
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.1 (no-pie & modified) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon


Last edited by Anon-E-moose on Thu Aug 01, 2019 6:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5021
Location: Dark side of the mood

PostPosted: Thu Aug 01, 2019 6:26 pm    Post subject: Reply with quote

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 ;-) .
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5021
Location: Dark side of the mood

PostPosted: Thu Aug 01, 2019 6:32 pm    Post subject: Reply with quote

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?
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5021
Location: Dark side of the mood

PostPosted: Thu Aug 01, 2019 6:39 pm    Post subject: Reply with quote

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.

:oops: 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...
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5021
Location: Dark side of the mood

PostPosted: Thu Aug 01, 2019 6:54 pm    Post subject: Reply with quote

Joke apart, it was really tricky nevertheless. I'm no specialist on DHCP options and settings but when I see this:
Code:
                      +------------------+
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.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!


Last edited by VinzC on Thu Aug 01, 2019 7:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 4311
Location: Dallas area

PostPosted: Thu Aug 01, 2019 6:58 pm    Post subject: Reply with quote

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.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.1 (no-pie & modified) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5021
Location: Dark side of the mood

PostPosted: Thu Aug 01, 2019 7:07 pm    Post subject: Reply with quote

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.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
alamahant
Tux's lil' helper
Tux's lil' helper


Joined: 23 Mar 2019
Posts: 95

PostPosted: Fri Aug 02, 2019 2:15 pm    Post subject: Reply with quote

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
Code:

chattr +iu /etc/resolv.conf

or some other kind of ACL to prevent it from being over-written?
Would that work?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14281

PostPosted: Sat Aug 03, 2019 12:32 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
alamahant
Tux's lil' helper
Tux's lil' helper


Joined: 23 Mar 2019
Posts: 95

PostPosted: Sat Aug 03, 2019 8:56 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6756
Location: Blighty

PostPosted: Mon Aug 05, 2019 2:01 am    Post subject: Reply with quote

alamahant wrote:
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.


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!
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5021
Location: Dark side of the mood

PostPosted: Tue Sep 10, 2019 9:32 am    Post subject: Reply with quote

Hi Roy. Nice to read from you 8) .

UberLord wrote:
Guessing that NetworkManager has sure fooled you!

Bwahahaha :lol:

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.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum