Page 1 of 1
Wildcard /etc/hosts file? ie) 192.168.1.2 *.example.com
Posted: Wed Oct 09, 2013 5:10 am
by vask
I have a staging sever and I want all gargoyle wireless clients to automatically resolve ALL subdomains of example.com to 192.168.1.2
All other DNS queries can be resolved normally
If I make a new subdomain I do not want to to have to add it to the configuration. ie)
vi /etc/hosts
192.168.1.2 new-subdomain.example.com
Please Advise
Re: Wildcard /etc/hosts file? ie) 192.168.1.2 *.example.com
Posted: Wed Oct 09, 2013 6:10 am
by vask
Solved by adding a single line in the dnsmasq config. Just ssh into the gargoyle router and do:
vi /etc/dnsmasq.conf
Then reboot the the gargoyle router and test
More Info
------------------------------------
man dnsmasq
Code: Select all
-A, --address=/<domain>/[domain/]<ipaddr>
Specify an IP address to return for any host in the given domains. Queries in the domains are never forwarded and always replied to with the specified IP address which may be IPv4 or IPv6. To give both IPv4 and IPv6 addresses for a domain, use repeated -A flags. Note that /etc/hosts and DHCP leases override this for individual names. A common use of this is to redirect the entire doubleclick.net domain to some friendly local web server to avoid banner ads. The domain specification works in the same was as for --server, with the additional facility that /#/ matches any domain. Thus --address=/#/1.2.3.4 will always return 1.2.3.4 for any query not answered from /etc/hosts or DHCP and not sent to an upstream nameserver by a more specific --server directive.
I don't think this is possible from the web interface ie)
http://192.168.1.1