You are not logged in.

#1 2023-03-19 13:45:18

gi1242
Member
Registered: 2022-07-07
Posts: 24

DNS Search for all network connections

Hi All,

I'm trying to add a domain (say `domain.com`) to my DNS search for all interfaces and wifi connections. So I'd like to type

ping host

and have it search for `host.domain.com`. In the old days I would edit `/etc/resolv.conf` and add the line:

search domain.com

and it would work. Now (after switching to `NetworkManager`, and `systemd-resolved`) it doesn't work anymore.

I can make it work on one particular connection by setting `ipv4.dns-search` and `ipv6.dns-search` to `domain.com`. But I have to do this for every single wifi network I connect to, which gets tiring.

Is there a simple way to fix this?

Thanks in advance

Last edited by gi1242 (2023-03-19 14:42:29)

Offline

#2 2023-03-19 14:02:23

seth
Member
Registered: 2012-09-03
Posts: 57,135

Re: DNS Search for all network connections

https://wiki.archlinux.org/title/System … cal_domain

Fall back to using glibc's dns instead of using systemd's resolve

Offline

#3 2023-03-19 14:34:05

gi1242
Member
Registered: 2022-07-07
Posts: 24

Re: DNS Search for all network connections

Thanks a lot! That's exactly what I needed.

I edited `/etc/nsswitch.conf` and made the following changes:

#hosts: mymachines resolve [!UNAVAIL=return] files myhostname dns
hosts: mymachines files myhostname dns resolve [!UNAVAIL=return]

I don't know what I'm losing by using glibc's DNS over systemd resolve...

I also realized from the link you posted that I can use /etc/hosts, and resolve it statically. There are like 10 host names I use often, so I'll probably just use that.

Thanks again.

Offline

Board footer

Powered by FluxBB