how can i show to all my customers when internet is down?

i have this scenario. I got an ISP and i would like to put some html+jpg in my routerboard and some way when my ISP is down mikrotik will foward that picture or html to everyone saying SORRY THE SERVICE WILL BE DOWN FOR A WHILE.

You have to set up web server somewhere and then just use netwatch that will enable nat rule which forwards all tcp/80 traffic to your internal webserver. And if link is back will disable that previous rule.

hi
yes i had it like that but i dont want to use a pc just for that i figured it could be posible to have all this solution in other routerboard instead of having a lot of things to do what i need. If you have any other ideal , i ll apreciate it a lot

thank you a lot for your quick replay

As far as I know there are no other solutions. You can’t use routers as webservers.

well, you could enable hotspot in these moments, and modify the login page to show your message :slight_smile:

thxs for ur answer , plz could you give me some basic guideline to follow , i never used hotspot option

well, you need to try the hotspot setup and see for yourself. in the situation you mentioned, you will need not hotspot created by wizard, but a manually created hotspot (so that it doesn’t make any dhcp-servers, upnp rules or other stuff you don’t need). this will not be easy to explain, maybe yo want to hire a consultant to do this.

if created correctly, in case of ISP problems you would just click the hotspot ‘enable’ button and all clients will be force-redirected to the login page, which of course would no longer have any login forms, but your own message. disable hotspot and internet access will be back

if you are using RB400 series routers, then you can use new metarouter feature.
Import openwrt image, install apache and use it as web server
it could be easier than messing with hotspot
http://wiki.mikrotik.com/wiki/Metarouter#OpenWRT_as_virtual_machine

Wouldn’t it be easier for you guys to stop shoving that hotspot in our face and just create a simple configurable webserver for RouterOS? Doesn’t need to run anything special. No Server Side scripting, no nothing. Just to serve static files.

Would be usefull to be able to add more than one on different ports. Let’s say a user could create a webserver on port 82 where you can redirect all your non-paying customers. You could create another one on port 83 to serve a page that the service is down, another one on port 84 and do whatever-stuff-you-want.

Also, you should think about adding a lm-sensors package for x86 in the near future. Many of us that have needs for high-troughput links are stuck with basic x86 platforms in many places and there are no ways to monitor the voltages/fans/temperatures.

that sounds good , but please could you tell me some guidelines to follow and do what you are saying to see if it 's works?

Get a secondary web server. Easiest solution by far.

Has anyone manage to get this type of rule up and running?
Given now that the system has moved on, is there any ‘easy’ way of doing this?

yeah is a good thing like gabak idea when the internet down is shows SORRY THE SERVICE WILL BE DOWN FOR A WHILE so that the customer are aware, i have my another rb running hotspot in a hotel sometimes the isp down and the guest call front office asking wats going on with the internet, if mik has a notification in page like this >>> (sorry the service temporarily down) so they are aware.

thanks

the solution was already provided in the second post from above

Hi,
Is there no way to just to put a simple Html files on the router, and all traffic route to that file should the netwatch detect something?

no, there isn’t. routeros doesn’t have a webserver you can use. currently it’s only for system use for hotspot and some other things

Ok given, there is a hotspot running on the RB I’d like to do this on - could it not be done all on that hotspot (without having to create another hotspot)?

Hey Bigguns,

This is what I did and it works perfectly. It only works when using the hotspot package.

Add the following code to your login.html hotspot page as such

<center><img src='http://www.SOME-EXTERNAL-WEBSITE.com/images/systemup.gif' onerror="this.src='/images/systemdown.gif'" / align="middle"></center>

Upload this attached image to some external website, and adjust the link in the code above for the first img src link to point to this systemup.gif image. Obviously edit the link in the above to the path where you put this gif file. Something like a imagehost service would work well

Then take this image gif

and place it in the /hotspot/images on your mikrotik router.

Now you need to add a allow dst-host entry in your walled-garden for the http://www.SOME-EXTERNAL-WEBSITE.com that you used in the above code for your login.html, so that when your login page gets loaded when your users first login, the login.html page will attempt to load the enternal website with that systemup.gif, successfully loading up the http://www.SOME-EXTERNAL-WEBSITE.com/images/systemup.gif proving that the internet is UP… If it fails to load that image, the internet must be down, so it then loads just the local image systemdown.gif stored in /hotspot/images of your mikrotik router.

Now after I figured that out I ran into a problem. Alot of us use cookies to keep our users logged in for 24hour or however long. So if the internet goes down, our currently active users would never see the login page because their sessions stay active until their cookies expire and they are not requested to login.

So to solve this problem.
We need to use the Netwatch feature to ping a known up ip address, like google.com and if it fails to ping the IP, then our internet must be down, so we run a script to remove all active sessions and cookies from the mikrotik router, causing the users to be directed back to the login page, thus seeing the systemdown.gif message. The code for the netwatch is as follows.

:local dumplist [/ip hotspot active find]
:foreach i in=$dumplist do={
    /ip hotspot active remove $i
}
:local dumplist [/ip hotspot cookie find]
:foreach i in=$dumplist do={
    /ip hotspot cookie remove $i
}

You netwatch should look sometihng like this

Thats all there is too it. I know its a lot, but if you follow the instructions and try it out, it will work perfectly.
When the internet is up, they will see the systemup.gif on your login page,
When the internet is down, they will see the systemdown.gif page and all active sessions and cookies will get removed, forcing active users when they try to load a webpage, back to the login page to see the systemdown notice.

Once this is setup, the only requirement is that

  1. that systemup.gif is accessable on the external website, you can use something like imagehost to host the systemup.gif
  2. that google can be pinged.

Its a thing of beauty isn’t it.

The only fault I see in it is if google.com is not pingable, because a route to the host is not up, but the rest of the internet is, then you may cause your active users to be booted back to the login page.
But there are other script out there if you look that you can use, that will test a couple of IP addresses and say if all 3 or however many you specify fail at pinging, then run the script code to remove active users and sessions.
The other thing is that, if after the internet goes down, the sessions and cookies are removed, the active users ge booted back to the login page and sees the main login page with the notice. If the try to login again, then they there cookie will get re-established, and they will be logged in again for the cookie liketime. They will no longer see the hotspot login page with the notice again. Maybe again with a better script written, like I mentioned above to ping 3 locations, you could schedule it to run every 10 seconds or whatever, meaning, that if it continued to fail eachtime the schedule ran, it would remove active cookies again. Thus booting those active users out again that tried to login after they were booted the first time. So it will continually clean the active sessions and cookies, as long as the 3 pings test fail.

Wow that is very nicly done - I shall be putting that on my system later today! I will let you know how it goes.

But good job

Karma to you Sir!

wow, would never imagine to use “onerror” to determine connectivity :slight_smile: nicely done!! give trevorlc1234 some karma :slight_smile: