I'm running Ubuntu server on a computer used as a wireless AP, but this AP should resolve all DNS requests to an internal IP address rather than actually performing the lookup.

I want to do the same thing that paid public WiFi hotspots do - you can connect but if you attempt to load any websites they show a default page. I've noticed that they do this by resolving all domains to an internal IP address.

I've added these lines to /etc/dnsmasq.conf:

# Add domains which you want to force to an IP address here.
# The example below send any host in double-click.net to a local
# web-server.

which works fine for those TLD's, but I'd like to be able to do it with all domains so I can sleep at night.

  • 4
    why not just use a captive portal like sputnik or the like? How do you plan to change DNS after they login? Jan 18, 2012 at 16:33
  • Trying to achieve this? If you edit your dhcpd and then do iptables -A PREROUTING -s -p tcp -j DNAT --to-destination
    – user
    Jan 18, 2012 at 16:40
  • @PaulAckerman I used public WiFi as an example. This AP will never allow real DNS requests to be made. I'll try the iptables thing.
    – Matt
    Jan 18, 2012 at 17:18

2 Answers 2


As the dnsmasq manual says …

… just use # for a wildcard:


  • 7
    rtfm indeed but god bless you anyway :D
    – Pitto
    May 10, 2013 at 13:41
  • 4
    Which manual? 'man dnsmasq' gives me a BOAT LOAD of command line options, but almost no information on config file layout.
    – Avian00
    Jun 11, 2013 at 11:31
  • 10
    I know this is late, but in case someone finds this useful: all the long options in the dnsmasq man page are valid in config files as well - all you need to do is drop the preceding dashes (and put each option on its own line). Event the argument syntax remains the same. Jul 13, 2015 at 1:23

Beware that although dnsmasq's manual might say anything in its version 2.86


no longer works — a bug probably.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .