Rocky 9 resolv.conf search

I’m not sure how to get DNS search domains to appear in resolv.conf in Rocky 9. In Rocky 8 this was configured in /etc/sysconfig/network-scripts interface specific files. There’s a text file there in 9 directing me to use /etc/NetworkManager/system-connections files. I’ve tried a few different lines in the interface specific file there w/ no luck yet, and I haven’t been able to find any documentation on this yet. Any thoughts? Thanks!

Use nmcli to set them. And then you can look at the system connections to see what it puts.

[root@xmpp01 ~]# nmcli con mod enp1s0 ipv4.dns-search "angelsofclockwork.net"
[root@xmpp01 ~]# nmcli con mod enp1s0 ipv6.dns-search "angelsofclockwork.net"

[root@xmpp01 ~]# cat /etc/NetworkManager/system-connections/enp1s0.nmconnection
[connection]
id=enp1s0
uuid=e81d9892-9c70-4a17-92f4-8ccf6b45c25c
type=ethernet
interface-name=enp1s0
timestamp=1684536757

[ethernet]
mac-address=52:54:00:14:9C:39

[ipv4]
address1=10.100.0.30/24,10.100.0.1
dns=10.100.0.1;10.100.0.231;10.100.0.232;
dns-search=angelsofclockwork.net;
method=manual

[ipv6]
addr-gen-mode=eui64
address1=2001:470:1f19:138::30/64,2001:470:1f19:138::1
dns=2001:470:1f19:138::1;2001:470:1f19:138::231;
dns-search=angelsofclockwork.net;
method=manual

[proxy]

[root@xmpp01 ~]# systemctl restart NetworkManager ; nmcli con up enp1s0
[root@xmpp01 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search angelsofclockwork.net
nameserver 10.100.0.1
nameserver 10.100.0.231
nameserver 10.100.0.232
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 2001:470:1f19:138::1
nameserver 2001:470:1f19:138::231
2 Likes

That worked perfectly, thanks so much for the quick response! I see the dns-search line now and I see that I can use +ipv4.dns-search to add additional search domains to that line.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.