MrCastro
MrCastro

Reputation: 485

dnsmasq - resolve all domains, including path, to the same address

I'm trying to setup a captive portal with a dnsmasq to resolve all domains to an internal IP address.

My /etc/dnsmasq.conf:

interface=wlan0
dhcp-range=10.0.0.2,10.0.0.10,255.255.255.0,12h
address=/#/10.0.0.1

Resolves to IP 10.0.0.1 if the domain includes no path, meaning:

http://www.nu.nl/  ->  10.0.0.1

but if it includes a path, it will try to go to 10.0.0.1/path

http://www.nu.nl/weekend  ->  10.0.0.1/weekend

which is not the intended behavior.

I'd like all domains to resolve to 10.0.0.1.

Any tips on how to do it? Thanks

Upvotes: 1

Views: 2096

Answers (1)

Brian White
Brian White

Reputation: 8746

DNS is a pretty simple protocol. Just implement your own server that responds to all requests with the address you want. It'll be simpler and more reliable than trying to configure some arbitrary tool. If you want only some devices to be tied to it, use iptables to forward only requests from those address to your server.

A colleague of mine did something similar: All requests show photos of cats.

Upvotes: 2

Related Questions