There seem to be a ton of questions on this topic and not clear answers to it.
Issue: when the ISP is down users dont realy know that, so when they connect and nothing happens, the login page does not come up. There are seemingly good solutions on notifying the users of the status like http://wiki.mikrotik.com/wiki/Notify_your_customers_internet_is_down,_monitor_connectivity but the issue is that without public internet users are not directed to that login page which would do the rest of the notifying. Most other solutions are suggesting to create DNS which makes no sense because the login page is fully factional if you browse to it manually by IP or hostname, the dns entry is automatically created with hotspot setup.
So anybody has a clear suggestion solutions on why redirection to the hotspot login page needs internet? and how to change it?
There are a ton of aplications that the hotspot can be used without the internet. Any RouterOS brainiacs please.
The DNS must be working because if one user has like “www.yahoo.com” as homepage,
the browser before to try to connect to the web sites and show login page, want the DNS solved.
If the DNS is not working, the user never see any type of web page, but simply one reply like “DNS not working” from the browser…
Catch the point?
well as i stated the DNS is not the issue in this case because I don’t need to resolve anything else but the hotspot itself and it is being resolved. I can ping by hostname ( from the router and the client) i can browse to it and it has an entry in the DNS automatically created and working fine. The issue is that the client when connected to the hotspot is not being redirected to a login page when there is no internet connectivity. If I do manually - no problem. And in my case the login page is not even a login it is made to login automatically, it just serves as start page for some info that I want users to see. The hotspot is not even intended to connect to the internet so it does not need to resolve any other hosts but itself. And it does it. The issue is when you try to browse for anything it should go to the login or in my case the info page.
Thanks though.
I think you not understand what I have writed.
-
Client connected to HotSpot must use hotspot DNS;
-
Client must have hotspot as homepage on browser.
Probably the first is true, by DHCP server / DNS redirect inside HotSpot,
but the client MUST ALREADY HAVE as homepage on browser your hotspot address, like when you entry it manually.
- If you want redirect all your users on “Sorry, no internet” page, you can create any rule on firewall, included force to use routerboard DNS, but if public DNS are not reachable, your message are never displayed if some user try to connect on one site not on DNS cache…
One of us not understand what the other says.
yes probably we misunderstand each other somewhere, but lets narrow it down. From what you are saying I understand that it is not possible to have all users directed to a “Sorry no internet” page without access to a public DNS.
your 1) point is easily accomplished by DHCP and that how it actually is.
2) cannot be used
3) If there is access to public DNS there is access to internet. In addition, how would this http://wiki.mikrotik.com/wiki/Notify_your_customers_internet_is_down,_monitor_connectivity solution work if what you are saying would be true ?
On the wiki is a big mistake: is supposed to work on login page, but is missing how to force login page to show up if DNS fails…
The concept is very simple: IF DNS CAN NOT BE SOLVED, THE HOTSPOT NEVER ARE USED BY BROWSER because if the dns not work, on what IP the browser try to open the web page?..
You must make one script on link down with force DNS to reply everytime for each site request the ip address of hotspot…
/ip dns static
add address=<hotspot-address> name=".*\\..*"
and remove the entry when the link come back
Thanks, this is big difference in a way that after making this DNS entry when the browser tries to browse anything on first attemtp it gets page not found 404 error and on the second it gets the “Sorry internet not available” So it looks like it can be done, please give me a suggestion on how to get it on the first try to browse.
My big hint is:
/ip dns static
add address=<address-where-page-not-internet-available-are> name=".*\\..*"
![]()
it’s hard help further without knowing all your network…
Do not believe, this can be done reliably: The browser (or clients PC) usually has a private DNS-cache. When connection to internet goes down, browser does not know about it. With next request, browser might use a cached DNS entry. Only when this fails, browser tries to do new DNS, getting your no-connect-page.
no I think it can and rextended pointes me onto a good route, It works to the points where I am testing it and so far the problem is that the commands in srcipts works only sometimes and sometimes do not. Thanks in any case, and its hard to believe that there is something that Mikrotik cannot do ![]()
Has nothing to do with MT. In case, there is no DNS entry in browsers or clients PC DNS-cache, the proposed solution will work, as there has to be a DNS request, immediately going to your no-connection-page. In case, user just navigates to another page in same domain, it will only work on second attempt. Or later. Thats, why I said, it can not work reliably in all cases on first attempt. So your wish, to always work on first attempt, can not be fulfilled in all cases.
Yes you are right. I got the scripts to work to change the DNS and when the ISP goes down the redirect happens from the Http://original_host/original.url to Http://mikrotik_hotspot/original.url and the mikrotik dispalys the “sorry internet is down” page but the images are not there. So My guess is that a more complex solution is needed to capture and redirect with layer7 on the firewall. And I am still pretty sure it can be done.
The images must be put on hotspot html directory to be showed, like the default mikrotik logo on default hotspot pages.
The problem is not http on port 80, but https on port 443, you can not redirect https page, because if for example you request https://www.google.com the hotspot can not impersonate www.google.com and you get only certificate errors…
is less complex than you think…
on internet down, simply redirect all traffic incoming from (hotspot) users tcp except ports 53, 443 and 8291 to hotspot port 80…
The one thing I found that was missing was adding a ttl for the static DNS. If you do not add one it will set it to 1 day which when your hotspot comes back online will mess you up.
electravis, vardas, if you’re still watching this thread, did you eventually find solutions that worked well and reliably for most clients, including Android?
I’m a mikrotik newb, and need to do basically what’s detailed in this thread, but don’t want to start if it’s not actually possible to do reliably ![]()
J
Ok so what we did is if there is no internet the user gets redirected to a std html page dished out by the tik. Seems to work for all devices we have tested.
First we have a static DNS entry that is disabled
0 XR ... 10.200.20.1 10s
Next we have a a netwatch rule that will either disable it if internet and disable if not
0 X host=8.8.8.8 timeout=3s interval=10s since=nov/16/2015 03:46:30
status=unknown up-script=/ip dns static disable numbers=0
down-script=/ip dns static enable numbers=0
Next you need two folders in your files your hotspot when you are online and hotspot when you are offline.
Finally one more netwatchrule rule
host=192.168.9.250 timeout=2s interval=10s since=dec/17/2015 08:50:10
status=up up-script=ip hotspot profile set Support html-
directory=hotspot-support-online
down-script=ip hotspot profile set Support html-directory=hotspot-
support-offline
Hope that helps
Has anyone succeeded in making it work? ![]()
Create a directory called maintenancePage and put there your html with the maintenance page files. No external references, a simple html page with few images would work.
Add fake DNS resolution (depending on ROS version, one of them will fail)
/ip dns static add address=1.2.3.4 comment=MAINTENANCE disabled=yes name=".*" ttl=10s
/ip dns static add address=1.2.3.4 comment=MAINTENANCE disabled=yes regexp=".*" ttl=10s
Add a Netwatch to enable these entries, change the directory of the hotspot and kick everyone out to force them to reauth
/tool netwatch
add down-script="{\\\r\
\n/ip dns static enable [/ip dns static find where comment~\"MAINTENANCE\"];\\\r\
\n/ip hotspot profile set [/ip hotspot profile find where html-directory~\"NORMALDIRECTORY\"] html-directory=\"maintenancePage\";\\\r\
\n/ip hotspot active remove [/ip hotspot active find];\\\r\
\n/radius disable [/radius find];\\\r\
\n}" host=REMOTEHOSTTOBEPINGED timeout=2s up-script="{\\\r\
\n/ip dns static disable [/ip dns static find where comment~\"MAINTENANCE\"];\\\r\
\n/ip hotspot profile set [/ip hotspot profile find where html-directory~\"maintenancePage\"] html-directory=\"NORMALDIRECTORY\";\\\r\
\n/radius enable [/radius find];\\\r\
\n}"
If you have custom configs on your device, adjust the script accordingly
Thank you, Muqatil for your answer.
I am trying to implement your solution now, but it sees that down/up scripts are not working.
I have two folders: “hotspot_office” - when internet is working and “hotspot_test” when ISP is down. However the html_directory as well as dns are not changed when ISP goes down.
Please see my screenshoots:
Netwatch host:

When ISP is down:

ISP up:
