OpenWRT - How to redirect all subdomains of a hostname, to the same host, so that it can be reverse proxied?
I sorted it out eventually.
According to:
https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#a_and_aaaa_rr
Which states:
This is an implementation of the --address option. Return 10.10.10.1 on query domain home and subdomain *.home.
I was able to login to OpenWRT (using ssh [email protected]
), and running:
uci add_list dhcp.@dnsmasq[0].address="/server.local/192.168.1.200"
uci commit dhcp
/etc/init.d/dnsmasq restart
Which then allows the following to work:
~$ ping www.server.local
PING www.server.local (192.168.1.200) 56(84) bytes of data.
64 bytes from server.local (192.168.1.200): icmp_seq=1 ttl=63 time=55.4 ms
64 bytes from server.local (192.168.1.200): icmp_seq=2 ttl=63 time=77.3 ms
And anything else for that matter:
~$ ping hdsjdjk.server.local
PING hdsjdjk.server.local (192.168.1.200) 56(84) bytes of data.
64 bytes from server.local (192.168.1.200): icmp_seq=1 ttl=63 time=101 ms
64 bytes from server.local (192.168.1.200): icmp_seq=2 ttl=63 time=124 ms
As I understand it, this creates an A record in DNSMasq, which automatically includes all subdomains.
The changes can be seen in /etc/config/dhcp
, which now looks (partially) like:
config dnsmasq
[...]
option domain 'local'
option local '/local/'
list address '/server.local/192.168.1.200'
[...]
Hopefully this helps someone else in the future!