Is there something like /etc/hosts file for SRV records? I would like my Alpine Linux server to find the value of _xmpp-server._tcp SRV record locally.


1 Answer 1


Linux does not have a built in method for that, you should look into dnsmasq and setup a lightweight DNS resolver, first install it

apk add dnsmasq

then we create a configuration file for example here /etc/dnsmasq.conf

put this inside

# Use the following DNS servers as the upstream servers

# Define your local SRV record

# Replace "example.com" with your domain and "server.example.com" with your server's hostname

then we start it

rc-service dnsmasq start
rc-update add dnsmasq

and now you can configure your server to use our DNS resolver, add this at the top of /etc/resolv.conf

  • Note that on modern distros, /etc/resolv.conf is often managed by NetworkManager or systemd which means changes will be overwritten on the next reboot/network change. Apr 9, 2023 at 16:14
  • @Ginnungagap Though you can generally override that in turn (or just make your changes and mark the file immutable, though things may complain vociferously about this in your log files). Apr 9, 2023 at 22:15
  • @Ginnungagap: You could...configure the NetworkManager or systemd-networkd connection profiles to use as the DNS server? Apr 10, 2023 at 6:00
  • Yes I was just warning against editing /etc/resolv.conf directly. I'm not saying it's unfeasible, just that the current will likely work temporarily only. Apr 10, 2023 at 8:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .