i am trying to implement captive portal with dnsmasq. In dnsmasq config address=/#/ doesn't work, so i have to use ugly

address=/gov/ ...

This redirects all listed domains fine, if in browser you go anywhere, however captive portal browser doesn't pop up by itself (checked no mac win and linux), and there is problem if site redirects to https (like facebook), my portal page is http only.

So how should it be setup correcltly to replace all domain names or even just make browser pop up with captive portal page?

UPD: acording to man page

--address=/#/ will always return for any query not answered from /etc/hosts or DHCP and not sent to an upstream nameserver by a more specific --server directive.

So how can i make sure there is no upstream hosts for the NetworkManager - dnsmasq?

  • Maybe # is being interpreted as the start of an inline comment. I would try \#.
    – bxm
    Jan 23, 2022 at 22:57
  • I assume the missing d is a transcription error when adding the detail to your post… ? adress=/#/
    – bxm
    Jan 24, 2022 at 7:39
  • sorry it was just typo here, in config it's fine Jan 24, 2022 at 8:03
  • Separate the browser redirection from the DNS activity. dnsmasq only handles DNS, so test that in isolation. For various values of testDomain such as cnn.com, bbc.co.uk. facebook.com, etc, does dig @yourDNSserver testDomain return expected values or not? Then you can concentrate your investigation in the appropriate corner Jan 24, 2022 at 9:00
  • @roaima thanks for your response, /#/ doesnt work - i mean if i leave only this line in config and do nslookup facebook.com - i still recieve real facebook ip . When i add /com/ line - it works fine and i recieve local captive portal ip. (browser behaves consistently) Jan 24, 2022 at 9:31

1 Answer 1


Works for me, version Dnsmasq version 2.80. I have just this in my dnsmasq.conf and every domain lookup returns

  • Do you have hotspot either? Jan 24, 2022 at 12:13
  • I've just run up severely reduced configuration file on a spare system I have. I use dnsmasq, but not as a hotspot. This configuration returns the same IP address for any query I can throw at it Jan 24, 2022 at 12:16

You must log in to answer this question.

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