#[SOLVED] DNS wont work properly, NetworkManager systemd resolved

190 messages · Page 1 of 1 (latest)

distant zenith
#

I have been trying to set my dns to 1.1.1.1 using systemd resolved and networkmanager but it just wont work? I have been trying to troubleshoot it but I lack knowlage on the topic. it did work once but broke down once I rebooted. here are some screenshots of the status.

#

I think the problem might be the preset showing disabled and the deamon says no deamon

steep blaze
#

preset disabled is just that it doesn’t start at boot by default, which is standard for almost everything in Arch

#

can you do resolvectl status? this shows what systemd-resolved is doing

#

I could also ask if you’ve done anything with /etc/resolv.conf

distant zenith
distant zenith
steep blaze
#

hm, which seems correct

#

can you try resolvectl query example.com?

distant zenith
steep blaze
#

yup, so resolved works

#

if there’s an issue it’s probably from whatever glue is between it and your applications

distant zenith
#

makes me happy atleast I couldnd manage that

steep blaze
#

you could try using wget or curl next

#

those should reference resolv.conf and hence should also use resolved directly

#

if it doesn’t we get a lead for troubleshooting

distant zenith
steep blaze
#

possibly, maybe

distant zenith
#

it did work once but broke again when I rebooted

steep blaze
#

I’m not fully sure just yet

distant zenith
#

sorry to keep you waiting I need to do smtg first

steep blaze
#

huh, apparently there’s something weird

#

in that NetworkManager needs to be started after resolved to use it?

#

you could try just restarting NetworkManager and see what happens

distant zenith
#

alright I will do that when I can

#

thanks a lot

#

huhhh??

#

it works now

#

wait a second im gonna reboot to see if it works again

#

okay I rebooted now it doesnt work

steep blaze
#

so, yea

#

NetworkManager can automatically pick up on systemd-resolved and use it

#

only if it detects that /etc/resolv.conf symlink

#

which seems to only work when systemd-resolved is running

#

so if NetworkManager starts before systemd-resolved it just doesn’t use it

distant zenith
#

so I just stop and start?

steep blaze
#

well, the proper way to fix it is to tell NetworkManager to explicitly use systemd-resolved in its config files

#

so this weird race condition doesn’t happen

#

from the Arch Wiki

distant zenith
#

Alright

distant zenith
steep blaze
#

.aw Help/Reading

distant zenith
#

I really need to learn how to create files using nano

slender parrotBOT
steep blaze
#

hm…

steep blaze
#

this explains some common conventions used in the Arch Wiki you may want to be aware of

steep blaze
#

you can just create files using nano

#

even if it says file doesn’t exist you can write what you want to put in and then save it

distant zenith
#

Oh I didnt know I cna just make a path using mkdir I thought I needed path to already exist

#

damn

steep blaze
steep blaze
#

I thought it was just the file that’s missing

#

but yea just make directories

distant zenith
#

okayy done

#

lemme reboot and see if it works

#

nop

#

it still wont curl discord.g

distant zenith
steep blaze
#

weird…

#

does resolvectl query still work?

distant zenith
#

yeah

#

it does

steep blaze
#

and if so does the restart NetworkManager trick work?

distant zenith
#

no

#

restart wont work

steep blaze
#

does resolvectl status say anything different now?

distant zenith
#

no its the same

distant zenith
#

oh no

#

it has changed

#

default route to yes

steep blaze
#

yup

#

and can you check if resolvectl query on a new domain still works?

distant zenith
#

doesnt work on discord as expected

steep blaze
#

okay, so

#

we’re going to get really deep into how systemd-resolved works, because it’s… weird

#

you’d think setting the global DNS would make every DNS query go through the global servers

#

and you’d be right… partially

#

see, systemd-resolved sends queries to every DNS server marked as default route, alongside the global server, in parallel

#

and this might be causing whatever weirdness here, since resolved is querying cloudflare twice

#

when NetworkManager is configured to use systemd-resolved, it dumps its own DNS config for systemd-resolved to use

distant zenith
#

I think I might have changed the default of networkmanager

#

let me check

steep blaze
#

in this case since your NetworkManager is telling systemd-resolved that it’s using Cloudflare’s DNS anyway, you could try just disabling the default one for systemd-resolved

#

it’ll fall back to only using the NetworkManager one

#

or you could disable NetworkManager getting DNS servers entirely, which would force usage of the DNS servers you configure in systemd-resolved’s config files

distant zenith
#

yeah I did change the default to network manager

distant zenith
steep blaze
#

yea

#

what I do on my laptop is I tell NetworkManager to not get DNS servers and only configure IP addresses

#

but I do this per network, which is really simple since I can just do it graphically in KDE’s networking settings

distant zenith
steep blaze
#

it’s just the little network icon in the tray

#

it has a button that lets you go to the Wi-Fi & Networking page in settings

#

which lets you configure every network you have with NetworkManager

distant zenith
steep blaze
#

this is probably less relevant to you since you’re running something with ethernet while I’m on a Wi-Fi only laptop

steep blaze
#

I just set ‘Automatic (Only addresses)’ in IPv4 and IPv6

distant zenith
#

tahts what its set for me

steep blaze
#

hm, I see

#

you probably did that to get cloudflare’s servers on NetworkManager probably

steep blaze
#

and then resolvectl status

#

hopefully that should get rid of the ethernet link’s DNS servers

distant zenith
#

doesnt seem like it

steep blaze
#

well, there used to be two

#

now there’s only one?

distant zenith
#

oh yeah it does

#

oh wait

#

it did?

#

oh no it didnt I mispelled discord with dicord 😭

steep blaze
# distant zenith

anyway, our aim is still to get rid of one of those DNS records so we are left with only one

#

can you see if 1.1.1.1 pops up anywhere in your NetworkManager config files?

steep blaze
steep blaze
#

well, that’s… odd

distant zenith
#

it did say 1.1.1.1 in the

#

ipv4 dns server

#

I just deleted that

steep blaze
#

oh, okay

#

then can you quickly disconnect and reconnect it?

distant zenith
#

this is how it is now

steep blaze
#

then check resolvectl status again

distant zenith
steep blaze
#

well, from the plasma applet

#

in the tray

distant zenith
#

okay Idid

#

here you go

steep blaze
#

and how’s resolvectl status now?

#

um

#

yikes

#

okay, well that 1.1.1.1 at the bottom should have disappeared but it didn’t

#

you could restart both NetworkManager and systemd-resolved at once

distant zenith
#

also first dns server changed from 1.0.0.1 to 1.1.1.1

steep blaze
#

and if that 1.1.1.1 still lingers I would say this is cursed

steep blaze
distant zenith
#

nope still does not work

#

wait at once?

#

yeah no still doesnt wor

distant zenith
#

it just works sometimes and once I reboot goes away

steep blaze
#

your system is weirdly cursed

#

I thought the original issue was just the race condition with NetworkManager autodetecting resolv.conf

#

so the proper solution should’ve been to explicitly configure it and make it not need to autodetect anymore

#

but we ran into a weirder problem

distant zenith
#

guess I am gonna try to trouble shoot it more

steep blaze
#

I mean, I can think of a bodge that can get it working now

#

namely – get rid of that dns.conf that tells NetworkManager to use systemd-resolved explicitly

#

and then add a little file that tells systemd to start NetworkManager after systemd-resolved

distant zenith
steep blaze
#

systemd still starts the two independently

distant zenith
#

I think I mightt have

steep blaze
#

did you?

distant zenith
#

installed systemd

#

twice or smtg

steep blaze
#

no, like

#

did you put anything in /etc/systemd/system/NetworkManager.service.d

distant zenith
#

uhh lemme check

#

says new file

#

its empty

steep blaze
#

yea, so you didn’t do what I described

#

this might be a little confusing, so

#

systemd, by itself, is the services manager

#

it starts all of your programs on system boot

#

systemd-resolved is a little thing the systemd project made that does stuff with DNS, but it’s not all that related to systemd the service manager

#

what I was describing is telling systemd, the service manager, to start the NetworkManager service after the systemd-resolved service

distant zenith
#

is there a manual page for that

steep blaze
#

yea, systemd.unit

#

anyway unfortunately I do have to leave this on a bit of a cliffhanger because I need to go

distant zenith
untold condorBOT
#

fleuriafluoride received a thank you cookie!

thin forge
#

... solved

slender parrotBOT
#

#9742 📣 If there is nothing else that we can do for you, please close this thread by adding "[SOLVED]" to the title.

  • You can do this on desktop by clicking the three dots on the top right of the page, and pressing "Edit Post".
  • You can also do this on Android / iOS by long tapping your post in the text channel list, and tapping "Edit Post".

Your title should be like so: https://cdn.discordapp.com/attachments/503224329191030787/1039841700417384498/image.png
Thank you

distant zenith
#

DNS wont work properly, NetworkManager systemd resolved [SOLVED]

#

[SOLVED] DNS wont work properly, NetworkManager systemd resolved

idle flame
#

hey there, sorry for the necromancy.
Im having issues configuring systemd-resolved