Score:5

Is it possible to create a local SRV record in linux?

us flag

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.

Score:3
by flag

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
server=8.8.8.8
server=8.8.4.4

# Define your local SRV record
srv-host=_xmpp-server._tcp.example.com,server.example.com,5269,0,5

# 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

nameserver 127.0.0.1
Ginnungagap avatar
gu flag
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.
mx flag
@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).
user1686 avatar
fr flag
@Ginnungagap: You could...configure the NetworkManager or systemd-networkd connection profiles to use 127.0.0.1 as the DNS server?
Ginnungagap avatar
gu flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.