Second local domain or alias of the first (dnsmasq)

How can I add a second local domain or an alias of the first?

I have some stupid hard-coded software that expects hostname.local to work.
And another one that expects hostname.lan

While I personally would like to offer things like wiki.workshop to the end-user.

Is this possible with dnsmasq or some rebinding magic?

I kinda know how to do it with dnsctptproxy, but would rather not have to send DNS requests back to dnsmasq and leave the pre-filter of local domains in dnsmasq on.

Can put any FQDN + IP address in: Network -> DHCP and DNS -> Hostnames.

root@OpenWrt:/etc/config# cat dhcp
..
config domain
        option name 'wiki.workshop'
        option ip '192.168.100.1'

Note modern browsers will try and 'help' with a domain like wiki.workshop so while the underlying OS will resolve it fine if given a chance the browser will tend to convert it to a search.

I tried that but could not find a way to get wildcard to work.

I don't really want to manually curate a list of IPs and services and what device is hosting what.

I'm after a setup that allows me to resolve any-hostname.lan but also any-hostname.local and any-hostname.workshop
Something like:

config domain
        option name '*.workshop'
        option ip '*.lan'

For me, looking up for example fritz.lan works just fine to get to a fritzbox that's currently running as dumb access point, but I do need to mess with the URL to convince the browser to just open fritz.
But if you have seen problems with hostname.lan what do you suggest as local domain to get around that.

btw: Cheers

cname ?

cname=somedomain.com,[somedomain2.com,]destinationdomain.com

not sure if the cname param is available via LuCI though.

It is, don't mind consol either ...

But it does not accept wild cards *, aka requires me to manually take care of things.

I'm also not sure if CNAME can rewrite something like any-random-hostname.worksop to the-same-random-hostname.lan

Best would be if I could just tell dnsmasq to create multiple local domains, but nothing I tried it liked ... might be a limit of uci, still have to try directly editing dnsmasq conf.

btw: Cheers

it doesn't look too complicated, but I haven't tried anything similar ...

1 Like

I need cname= *.worksop,*.lan.

But luci anyways complains as soon as I enter and asterix *.

Will try what happens if I enter it directly on the config.

Cheers

Ah the joy of shitty hard-coded software, otherwise I would just set the local domain to .worksop and be done with it

there's https://github.com/lixingcong/dnsmasq-regex, but I don't know if the feature's in the "real" dnsmasq.

there's actually a link to an openwrt version at the bottom of the page.
need to build it though.

1 Like

Do you expect an infinite amount of subdomains and you cannot make a list of CNAMEs ?
Or maybe if you could describe what is the situation right now, we could think of a better way.

1 Like

found https://github.com/uktrade/dns-rewrite-proxy, but it requires Python :frowning:

I can do that with dnscrypt proxy (I think) and will do that as last resort, but would rather define multiple local domains.

You are a legend tho, Im currently reading through the dnsmaq documentation ... Hoping I find something Google didn't.

check if you can find the feature in bind/bind9, it's also available in openwrt.

Well, I have some stupid IoT that tries to find each other on .local ..

I personally like .lan to ping local machines by hostname and for general administrating.

I would like to offer everything that provides a "web-page" under hostname.worksop(just an example) to the end-user because they will remember that name and things like wiki.workshop or kodi.workshop or printer.workshop make a bit more sense than .lan especially for people for whom lan just means 3 random letters.

Cheers everybody, I will do some digging.

Was mainly hoping I was a tad stupid, or it's just something like sure just specify multiple local domains separated by semicolon.

if it's http based, then redirect can be done in the webserver, apache got mod_rewrite, and I think there's one in lighttpd too, but I guess you have to point all those DNS names to the IP of the web server.

Sure, but again only works if it's in my hand.

I expect random people to bring in a random TV box or their NAS or a development setup or ... and if it's hosting something it should be available preferable under .local .lan and .workshop

If you don't mind having them in a different vlan, then it is possible to run multiple instances of dnsmasq per interface.