Community discussions

MUM Europe 2020
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

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

Wed May 27, 2009 7:31 am

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.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5950
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

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

Wed May 27, 2009 7:55 am

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.
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

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

Wed May 27, 2009 8:04 am

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
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5950
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

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

Wed May 27, 2009 8:09 am

As far as I know there are no other solutions. You can't use routers as webservers.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24337
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

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

Wed May 27, 2009 10:30 am

well, you could enable hotspot in these moments, and modify the login page to show your message :)
No answer to your question? How to write posts
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

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

Wed May 27, 2009 2:56 pm

well, you could enable hotspot in these moments, and modify the login page to show your message :)
thxs for ur answer , plz could you give me some basic guideline to follow , i never used hotspot option
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24337
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

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

Wed May 27, 2009 3:07 pm

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
No answer to your question? How to write posts
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5950
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

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

Wed May 27, 2009 3:14 pm

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/Metaroute ... al_machine
 
Znuff
Member Candidate
Member Candidate
Posts: 141
Joined: Tue Sep 26, 2006 2:42 am
Contact:

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

Wed May 27, 2009 8:29 pm

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.
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

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

Wed May 27, 2009 9:48 pm

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?
 
Znuff
Member Candidate
Member Candidate
Posts: 141
Joined: Tue Sep 26, 2006 2:42 am
Contact:

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

Thu May 28, 2009 1:06 am

Get a secondary web server. Easiest solution by far.
 
bigguns
Member Candidate
Member Candidate
Posts: 238
Joined: Thu Apr 01, 2010 9:03 am

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

Mon May 31, 2010 2:08 am

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?
 
Myron
Member Candidate
Member Candidate
Posts: 253
Joined: Sat Sep 05, 2009 3:17 am
Location: Boracay, Philippines

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

Mon May 31, 2010 5:56 am

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.

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
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24337
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

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

Mon May 31, 2010 8:28 am

the solution was already provided in the second post from above
No answer to your question? How to write posts
 
bigguns
Member Candidate
Member Candidate
Posts: 238
Joined: Thu Apr 01, 2010 9:03 am

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

Mon May 31, 2010 12:03 pm

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?
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24337
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

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

Mon May 31, 2010 12:12 pm

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
No answer to your question? How to write posts
 
bigguns
Member Candidate
Member Candidate
Posts: 238
Joined: Thu Apr 01, 2010 9:03 am

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

Mon May 31, 2010 12:16 pm

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)?
 
trevorlc1234
just joined
Posts: 19
Joined: Tue May 25, 2010 8:46 am

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

Thu Jun 03, 2010 8:05 am

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
Image

Then take this image gif
Image
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/im ... stemup.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
Image

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.
Last edited by trevorlc1234 on Thu Jun 03, 2010 8:23 am, edited 1 time in total.
 
bigguns
Member Candidate
Member Candidate
Posts: 238
Joined: Thu Apr 01, 2010 9:03 am

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

Thu Jun 03, 2010 8:15 am

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!
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24337
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

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

Thu Jun 03, 2010 8:22 am

wow, would never imagine to use "onerror" to determine connectivity :) nicely done!! give trevorlc1234 some karma :)
No answer to your question? How to write posts
 
trevorlc1234
just joined
Posts: 19
Joined: Tue May 25, 2010 8:46 am

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

Thu Jun 03, 2010 8:33 am

Thanks guys,

I find it works very well. Let me know how it goes BigGuns
 
risipetillo
Frequent Visitor
Frequent Visitor
Posts: 63
Joined: Tue Feb 03, 2009 7:08 pm

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

Thu Jun 03, 2010 9:05 pm

KISS Principle at it's best, I love it !!
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8321
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

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

Thu Jun 03, 2010 9:59 pm

trevorlc1234, nice idea! please make Wiki page not to lose this post! http://wiki.mikrotik.com/wiki/MikroTik_RouterOS
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
trevorlc1234
just joined
Posts: 19
Joined: Tue May 25, 2010 8:46 am

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

Thu Jun 03, 2010 11:01 pm

I will do, that's a great idea. I will improve the netwatch script there also so it tests 3 differnt ip's before failing and like I mentioned above make it continue to clear active sessions while the connection is down so every user is always directed back to the login page. Just stuck in traffic now. dead stop... Heading ip to my cottage where I operate my WISP, so I can test the improved netwatch script I write tonight to include on the wiki page. Got some new equipment to install up there too yay. Won't be boating this weekend looks like it's going to rain so time for some WISP upgrades
 
fewi
Forum Guru
Forum Guru
Posts: 7734
Joined: Tue Aug 11, 2009 3:19 am

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

Thu Jun 03, 2010 11:05 pm

Just an idea, but maybe instead of continuing to clean active connections you could just disable all the login methods (cookie, PAP, CHAP, HTTPS etc.) when an outage is detected and all active connections have initially been cleared. That way no one can login in the first place. Then re-enable them again once the outage is over.
 
lukkes
Member Candidate
Member Candidate
Posts: 163
Joined: Mon Jun 16, 2008 2:12 am
Location: Venezuela
Contact:

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

Fri Jun 04, 2010 5:14 am

really good idea, another easy way can do this it's make an script that check the internet connection by ping, or simple netwatch and when the connection is down just enable a hotspot with customized login page, it's simple... when the connection is up again the script disable the hotspot
like this or something: /ip hotspot [/ip hotspot find] disabled=yes or not..
If you found this post useful don't forget about the karma viewtopic.php?f=1&t=41148

Feed Your FAITH Then Your Doubts Will Starve To Death...!!!
 
bigguns
Member Candidate
Member Candidate
Posts: 238
Joined: Thu Apr 01, 2010 9:03 am

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

Sun Jun 06, 2010 3:42 am

Hey
Sorry it took me so long to come back on this one - I'm now using your coding and I can report that this is working 100% very nicely indeed. Just what I had been hoping for.

trevorlc1234 - could you send tell me your email address please.
 
trevorlc1234
just joined
Posts: 19
Joined: Tue May 25, 2010 8:46 am

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

Mon Jun 07, 2010 6:09 am

Hey Bigguns,

Glad the script is working for you. Im not sure how to send you my email. My forum account doesn't let me PM and I don't want to post it here.

I have added a Wiki page on this at
http://wiki.mikrotik.com/wiki/Notify_yo ... nnectivity

I will eventually improve on the monitoring script to montior 3 hosts before posting the notice that internet is down. When I do this I will update the Wiki page with the code script.
 
bigguns
Member Candidate
Member Candidate
Posts: 238
Joined: Thu Apr 01, 2010 9:03 am

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

Mon Jun 07, 2010 7:10 pm

Hey, nice job with the wiki page.

Can you email me at XXXX (i will pick it up and then route all traffic to the blackhole afterwards.

Thanks
Last edited by bigguns on Mon Jun 07, 2010 8:19 pm, edited 1 time in total.
 
trevorlc1234
just joined
Posts: 19
Joined: Tue May 25, 2010 8:46 am

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

Mon Jun 07, 2010 8:12 pm

Ok send now. should be there
 
riaanmaree
Frequent Visitor
Frequent Visitor
Posts: 66
Joined: Thu Aug 31, 2006 10:42 pm
Location: Johannesburg, South Africa
Contact:

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

Mon Jun 07, 2010 10:56 pm

Just some advice:

This all sounds and look very cool, but just make sure that you are indeed aware of the outage when it happens by monitoring it with The Dude or something like that.

Users might be patient for days before phoning when they see a message saying "we are aware of the problem", but you may not be aware of it if they don't phone you!
:lol:

Who is online

Users browsing this forum: No registered users and 69 guests