Page 1 of 1

DNS redirect over HotSpot Proxy

Posted: Fri Feb 05, 2016 3:47 pm
by kaptain46
Dear all,
thank you in advance for any support :)

I'm making a DNS redirect solution for Mikrotik hotspot, where I need redirect all DNS request from Hotspot in order to redirect them to my DNS server without change any parameters on routerboard.

Actually, I do some research and I'm doing it with the same Nat rule using dst-nat:
/ip firewall nat add chain=pre-hotspot protocol=udp dst-port=53 hotspot=auth action=dst-nat to-addresses=xxx.xxx.xxx.xxx
In this way:

1) all DNS request by unauthenticated hotspot users come to hotspot DNS Proxy on port 64872 using default dynamic rules (in this way I can use correctly captive portal for login)
2) all DNS request by authenticated hotspot users are intercepted with the dst-nat rule and redirect to my DNS server without pass into DNS Proxy

The onyl issue that I've have is that with this configuration, authenticated user cannot see status page on any page on hotspot 'cause its DNS request are redirected to the external DNS server that cannot solve hotstpot DNS name.

The, I think that the only way is to act this dst-net redirection rule after hotspot DNS proxy, catching DNS request outcoming from hotspot DNS proxy and redirect him to my DNS; does anyone know I can do this?

I've already tried all chain hotspot, hs-auth but I cannot do it :(

Re: DNS redirect over HotSpot Proxy

Posted: Fri Feb 05, 2016 9:00 pm
by ZeroByte
You need to put an entry in your DNS server that gives the hotspot IP address for the same name...

e.g. hotspot.example.com IN A 192.168.1.1

Of course, ALL of your hotspots (if you have multiple installations) would need to use the same internal IP, or else each one with a different IP would need a unique hotspot name (e.g. hotspot2.example.com IN A 192.168.2.1)

So long as the real DNS server gives the same answer that the Mikrotik would give, then there's no need to redirect dns back to the proxy if the packet contains a request for the hotspot name.


Or - if you want to proxy all requests and make the proxy send its requests to your server, just go into the system DNS settings and specify your servers as the system DNS servers. That's all the proxy does - it goes to the system's DNS resolver and then caches the answer. Anything defined as local static will be given instead of whatever's in real DNS, but other than that, the proxy is just that - a proxy. It doesn't perform recursive queries like a real DNS resolver daemon will.

Re: DNS redirect over HotSpot Proxy

Posted: Wed Feb 10, 2016 11:39 am
by kaptain46
hi ZeroByte,
thank you for your answer.

I've just applied your suggestions about DNS entry and everything works well :D

Re: DNS redirect over HotSpot Proxy

Posted: Mon Mar 13, 2017 3:50 pm
by ferasawadi
Hello ,
am using L2TP server and PPPOE server
am using usermanager , and for now my clients hits : 10.0.0.1/user and enter their account dietails to get data about the account .
i want them first to hit : hinet.com istead of typing the address : 10.0.0.1
besided
i need the status page to appear as Hotspot .
is this possible ???
i have done alot of researches but i did not Figued out how to do it until now .
can you help please .
than you