Setting up a srv record with dnsmasq - do I need to use a FQDN?

3

I'm currently running a linux based/DIY router that provides a few additional services. I don't currently have a domain set up, and I'd like to set up a srv record for certain services hosted on the router itself. I'm using dnsmasq for internal DHCP and DNS. I do not have the domain option set but I can set an unused domain/subdomain for it

The router's internal ip is 192.168.1.1, and it has a hostname router that seems to resolve from the other PCs.

This is what the appropriate line in the dnsmasq.conf looks like

# A SRV record sending LDAP for the example.com domain to
# ldapserver.example.com port 389 (using domain=)
#domain=example.com
#srv-host=_ldap._tcp,ldapserver.example.com,389

The example given in the dnsmasq looks like so - can I use any arbitrary valid domain for the domain - and can I use the ip address or a plain hostname like router for the host?

Or do I need to set a domain that I know isn't in use and use that for the hostname?

Journeyman Geek

Posted 2018-11-15T21:10:43.037

Reputation: 119 122

Answers

1

After some testing - I discovered in my specific case, where the service is running on the same box that's running dnsmasq, setting a srv record by IP appears to be a better option.

So, testing process was testing pinging the router by hostname and ip to ensure stuff resolved.

I then tested two options

srv-host=_aserv._tcp,hostname,1688 and srv-host=_aserv._tcp,192.168.1.1,1688 in dnsmasq

I then tested them with nslookup -type=srv _aserv._tcp

By IP

Server:  router
Address:  192.168.1.1

_aserv._tcp     SRV service location:
          priority       = 0
          weight         = 0
          port           = 1688
          svr hostname   = 192.168.1.1

By Hostname

C:\Users\faile_000\Desktop>nslookup -type=srv _vlmcs._tcp
Server:  UnKnown
Address:  192.168.1.1

_aserv._tcp     SRV service location:
          priority       = 0
          weight         = 0
          port           = 1688
          svr hostname   = router
heckate_router  AAAA IPv6 address = ::1
heckate_router  internet address = 127.0.0.1

In this case, setting it by hostname causes it to resolve to itself. If I either explicitly set the hostname for the server, or if it was another server this might work.

Journeyman Geek

Posted 2018-11-15T21:10:43.037

Reputation: 119 122

0

Yes, you can use any valid domain for the domain.

Requesting a domain in your browser (or elsewhere) will first search your hosts file for fitting domains, then escalate that request to its registered DNS server (most likely your router) which will first parse it's own DNS entries (which is essentially too a hosts file). If your router does not find the correct entry it will escalate it to its own registered DNS server.

So to do that in your own network the easiest solution is to add an DNS record for this specific domain in your router and if your router has it add the same domain to it's DNS-Rebind-Protection to prevent any DNS requests for this domain to leave your local network.

You could for example even use external IP addresses like 8.8.8.8 as host name, but you'd have to reroute that request via Iptables or similar to prevent it from being routed straight to Google.

Fair warning: You won't be able to access the (real) domains/Ipaddresses if you remap them on your router.

Nordlys Jeger

Posted 2018-11-15T21:10:43.037

Reputation: 846

Which is fine - I can just use a subdomain on a domain I own just for SRV records of this sort, and it's purely for use inside my home lan – Journeyman Geek – 2018-11-16T12:14:50.893