Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] NetworkManager does not set my custom DNS (Read 6131 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[SOLVED] NetworkManager does not set my custom DNS

I've set a custom DNS in my network manager because by default it doesn't seem to resolve most addresses when I use NetworkManager instead of some wpa_supplicant scripts. For example:
Code: [Select]
[rocky@cassini ~]$ ping asdf.om
ping: asdf.om: Name or service not known

My /etc/resolv.conf:
Code: [Select]
# Generated by NetworkManager
nameserver fda6:ec2c:8511::1

Thanks

Re: NetworkManager does not set my custom DNS

Reply #1
I've set a custom DNS in my network manager because by default it doesn't seem to resolve most addresses when I use NetworkManager instead of some wpa_supplicant scripts. For example:
Code: [Select]
[rocky@cassini ~]$ ping asdf.om
ping: asdf.om: Name or service not known

My /etc/resolv.conf:
Code: [Select]
# Generated by NetworkManager
nameserver fda6:ec2c:8511::1

Thanks


are you using a dhcp server?  There is not enough information here.  All DNS is custom....

Re: NetworkManager does not set my custom DNS

Reply #2
I'm using DHCP on my router. The script I mentioned use use wpa_supplicant and dhcpcd to connect and get an IP.

Those scripts set up my router as my DNS. Since NetworkManager wasn't working out of the box (I could access, say, google.com but not asdf.com) I tried setting the DNS in the IPv4 settings to 1.1.1.1 and my /etc/resolv.conf still only had that ipv6 address and websites still weren't resolving.

I can give more information when I get home, this computer isn't in front of me right now.

Thanks

Re: NetworkManager does not set my custom DNS

Reply #3
You should specify always when presenting an issue if you are running on OpenRC or Runit.
# ip a
should show you what interfaces you have and if they are active
Other than dhcpcd you need dhcpcd-runit/openrc and activate them.
# dhcpcd
Will start it anyhow.

One of the reasons I stopped using nm is because it loves to rewrite my settings to its own, and dns was part of my problem.
I also use net-tools and ifconfig in particular to activate intefaces and deactivate them.
example:
# ifconfig eth0 up
# ifconfig wlan0 down


Re: NetworkManager does not set my custom DNS

Reply #4
You should specify always when presenting an issue if you are running on OpenRC or Runit.
# ip a
should show you what interfaces you have and if they are active
Other than dhcpcd you need dhcpcd-runit/openrc and activate them.
# dhcpcd
Will start it anyhow.

One of the reasons I stopped using nm is because it loves to rewrite my settings to its own, and dns was part of my problem.
I also use net-tools and ifconfig in particular to activate intefaces and deactivate them.
example:
# ifconfig eth0 up
# ifconfig wlan0 down



DHCPCD is vixies DHCPCD FWIW and network manager usually uses dhcpclient

FWIW, 1.1.1.1 is a dns server outside of your network owned by digital ocean if I am not mistaken.  Aside from the problems involved with depending on them, the fact that you are not reaching them seems to me tat your routing is messed up, and possibly the wifi if you are using it.

Re: NetworkManager does not set my custom DNS

Reply #5
I'm using openrc. I have installed the init scripts for Network Manager already.

I think the topic name might be misleading. All I really want is my DNS to work. I had tried to set it manually to cloudflare's (1.1.1.1) but it didn't work.

Other devices on my network are working fine including a phone and nintendo switch on wifi as well as an Artix desktop on ethernet. The only thing not working right now is my laptop when I use networkmanager.

Networkmanager is configuring the ipv6 DNS correctly to point at my router. The ipv4 dns entry is missing from resolv.conf. My phone, nintendo switch, and desktop all are getting their ipv4 DNS set to the router correctly so it isn't a problem with the router.

Re: NetworkManager does not set my custom DNS

Reply #6
If I manually run dhclient after NetworkManager has finished getting an ipv6 lease I get an ipv4 lease and my dns and gateway is set right.

This is sounding suspiciously like this issue over at Manjaro: https://forum.manjaro.org/t/no-ipv4-with-wifi/13359/16

Re: NetworkManager does not set my custom DNS

Reply #7
The second response here worked for me! https://bugzilla.redhat.com/show_bug.cgi?id=1468358

The one about changing the dhcp client identifier:
Quote
Does it work if you change the client-identifier of the connection to a type+mac one? i.e.:

 nmcli connection mod <connection-name> ipv4.dhcp-client-id 01:xx:xx:xx:xx:xx:xx
 nmcli connection up <connection-name>

where xx:xx:xx:xx:xx:xx is a MAC address?

Why isn't it doing this by default? *edit* or is this simply masking a problem?

Re: NetworkManager does not set my custom DNS

Reply #8

That is not relavent
Quote
I have installed the init scripts for Network Manager already.

That should have been installed with the OS installation.  Why this needs to be done by hand is a puzzle.

Quote
I think the topic name might be misleading. All I really want is my DNS to work. I had tried to set it manually to cloudflare's (1.1.1.1) but it didn't work.

If you have no network you can't get DNS and DNS is often set by a DHCP application, either by networkmanger or by the init scripts directly

You also must be on the broadcast leg of the network that has the DHCP server, or your are shouting into the wind.

Quote
Other devices on my network are working fine including a phone and nintendo switch on wifi as well as an Artix desktop on ethernet.

I'm tempted to say I don't care, but I will be polite and say it doesn't matter.

Quote
The only thing not working right now is my laptop when I use networkmanager.

FWIW, the most likely point of failure here is the wifi connection.  Check the network with ifconfig


Quote
Networkmanager is configuring the ipv6 DNS correctly to point at my router.

How do you know that?

Quote
The ipv4 dns entry is missing from resolv.conf. My phone, nintendo switch, and desktop all are getting their ipv4 DNS set to the router correctly so it isn't a problem with the router.

Is network manager started?

Re: NetworkManager does not set my custom DNS

Reply #9
BTW - I always start dhcpcd by hand because I hate playing with Networkmanger.  It has enough trouble just keeping the wifi up..

Re: NetworkManager does not set my custom DNS

Reply #10
fungalnet asked.
That should have been installed with the OS installation.  Why this needs to be done by hand is a puzzle.
I installed only the base system and then cinnamon. I never said I needed to install it by hand.

If you have no network you can't get DNS and DNS is often set by a DHCP application, either by networkmanger or by the init scripts directly
Yeah, figured that out already

I'm tempted to say I don't care, but I will be polite and say it doesn't matter.
Other devices work fine. That was my point, refuting that my router was the issue. Saying "I'll be polite" doesn't make it polite.

FWIW, the most likely point of failure here is the wifi connection.  Check the network with ifconfig
dd

See my /etc/resolv.conf in my first post.

Of course it is, otherwise I wouldn't even have gotten that far.

Did you not read my last post? Setting the DHCP client id fixed it.

Re: NetworkManager does not set my custom DNS

Reply #11
Can we move this thread to Configurations please .... sorry for the Meta discussion.

Re: NetworkManager does not set my custom DNS

Reply #12


Did you not read my last post? Setting the DHCP client id fixed it.


Yes, I did read it.  It is often the case that it works when you run it by hand.  I think the question you have now is why Network manager doesn't do it automatically, or do you consider the issue solved now?


 

Re: NetworkManager does not set my custom DNS

Reply #14
Is moving the thread something I need to do or does a mod need to do it?
Sorry, this post might feel a bit disjointed. It's getting late here.

I think I found the problem, same as this person's: https://forum.artixlinux.org/index.php/topic,701.msg5433.html#msg5433

When I set my dbus machine-id, networkmanager sets the ipv4 dns correctly without my setting the dhcp client id. It isnt' automatically setting it to the 01:<mac address>, it's still not set like it did without machine-id. My best guess is that it is trying to talk to dhclient over dbus and it can't without the machine-id being set.

For whatever reason the dbus install scripts don't set /etc/machine-id or /var/lib/dbus/machine-id. dbus-uuidgen > /etc/machine-id. I had a similar problem with KDE plasma a week ago but I must have accidentally reverted that fix at some point.

So I guess the real question is, why isn't the dbus machine-id getting set? I think this is the answer: https://www.reddit.com/r/archlinux/comments/6kwt61/systemd_doesnt_create_machineid_during/

Sounds like normally the machine-id is set by systemd-firstboot according to the arch folks. If that's really the case, I would think folk who migrated arch linux would not have this issue, but since I installed it fresh from the artix livecd mine isnt' set.

And btw I confirmed, that ipv6 in my resolv.conf was my router's ipv6 on my lan. Going back to my example websites I used in the first post, google.com can resolve with "ping -6" but asdf.com can't. My ipv6 DNS was working the whole time. Just not ipv4.

In any case, I'm going to mark this as solved, though I'm going to open up another issue about the systemd-firstboot and dbus's machine-id.