OPNsense Forum

English Forums => General Discussion => Topic started by: Sar6e on September 09, 2022, 01:28:17 AM

Title: Name resolution that includes port number?
Post by: Sar6e on September 09, 2022, 01:28:17 AM
I'd like to not have to remember all the port numbers for the various docker containers running on a single host.  Ideally I'd be able to type "service.server.domain" and have the DNS be able to resolve that to ip:port.

For example if my wiki is exposed as port 9082 on the server fred at hb.com at 192.168.1.100, it would be great to just type wiki.fred.hb.com and have that resolve to 192.168.1.100:9082 rather than having to remember which port the wiki uses.

Is there a way to achieve this or am I dreaming?
Title: Re: Name resolution that includes port number?
Post by: bartjsmit on September 09, 2022, 07:54:50 AM
You mean a SRV record? https://en.wikipedia.org/wiki/SRV_record
Title: Re: Name resolution that includes port number?
Post by: Bob.Dig on September 09, 2022, 08:04:48 AM
It is called reverse proxy.
Title: Re: Name resolution that includes port number?
Post by: Sar6e on September 13, 2022, 12:38:49 AM
Quote from: bartjsmit on September 09, 2022, 07:54:50 AM
You mean a SRV record? https://en.wikipedia.org/wiki/SRV_record
Thanks for the reply.  Looking at that wikipedia entry, I think so.  I found an old reddit thread which suggests srv records can be added to the "Custom Option" in Unbound DNS.  I'm not seeing that option any more in the general settings page of the Unbound DNS Service so things may have changed. 

At least though it gives me a search term to investigate further.  I find half the battle is working out what the thing you need is called.  I want to say I used to be able to create an alias in Sophos UTM...
Title: Re: Name resolution that includes port number?
Post by: meyergru on September 13, 2022, 10:31:36 AM
No browser can interpret SRV records. But the approch of using HA-Proxy as a frontend is viable.

You could hide all docker containers behind one IP with several names and have HA-Proxy do the distribution to different docker backends.