manual srv entries in local.list

i wanna specify an srv records in the local.list as i do for A records because i need to resolve an hostname to a specific port and i don't even know if this is possible at al

Can you provide an example of what you want to do? It sounds like you want to map a local client name to an IP address?

i want to map a client name to a socket ip:port, for example when i execute home.web it redirects me to a specific port of a specific ip

Information on dnsmasq configuration is found here: Man page of DNSMASQ

There is an entry for configuring SRV records.

1 Like

yeah i already read about how to configure srv records but i need to figure out where i have to apply them, i mean, the local.list accept srv records? i have mine populated with A records like "#.#.#.# home.web", should i put srv like "--srv-host=<_service>.<_prot>.[],[[,[,[,]]]]" in there?

local.list should not be modified, it is just a generated Pi-hole file. Edit your dnsmasq configuration at /etc/dnsmasq.conf or a new file in /etc/dnsmasq.d/. You don't need the leading -- for config entries.

1 Like

got it, i already created a .conf file in /etc/dnsmasq.d/ (other than the default 01-pihole.conf) because i need to specify multiple incoming interface, can i use it to even add the srv records?

and can you please give me an example to how can i resolve home.web to 192.168.1.99:20080 with srv?

pi@noads:~ $ echo 'srv-host=_http._tcp.home.web,192.168.1.99,20080,10,1' | sudo tee /etc/dnsmasq.d/99-my-settings.conf
srv-host=_http._tcp.home.web,192.168.1.99,20080,10,1

pi@noads:~ $ sudo service pihole-FTL reload
pi@noads:~ $

pi@noads:~ $ host -t srv _http._tcp.home.web
_http._tcp.home.web has SRV record 10 1 20080 192.168.1.99.

But your software needs to specifically do SRV lookups.
You cant use it like in for example a browser that only does A or AAAA record lookups.
.......... I think :wink:

2 Likes

thank you your detailed response, and you're right about browsers, they don't support srv so i want to ask if it's possible to find a way around it, an alternative to srv to map an address:port to an hostname or it's better to let this idea go ^^ anyway i want to thank you all for your amazing support guys, you rocks!

Do you mean solely via DNS ?
I dont think so.
You can with a proxy or router ... and maybe some more options exists that i dont know of.

1 Like

i will check about that, have a great day!

1 Like

Yeah SRV got you on the wrong foot.
Its mostly used to get some sort of crude load balancing with weighted responses.
Try run below one a couple of times targeting apt.xbian.org for mirrors and see who comes on top:

host -t srv _http._tcp.apt.xbian.org

on top of results i got all of them alternatively, so srv is only used for balancing?

To my knowledge, yes plus some form of HA.

thank you, today i learned a lot about dns ^^

1 Like

This refreshment course makes me wonder why browsers and other software dont support SRV.
Enter discourse.pi-hole.net in the browser and it should connect to one of the SRV mirrors on any port you like.
So much I dont know :smiley:

1 Like

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