Troubleshoot Page for Client Radios when offline

When: Client radio is offline and has no internet.

I made a script that 3 many times to make sure internet is offline then will run some commands and vis versa when the internet is back up. I got this part done.

What I want is to have a firewall rule that will redirect the customers tcp port 80 to the local mikrotik www. On the mikrotiks www I want to make a website that displays instructions on how to troubleshoot etc..

Mikrotik what do you think about this. Can it be done?

The only easily available web server in RouterOS that you can customize is the Hotspot one. How to use it to serve arbitrary pages is documented in the forums, such as here: http://forum.mikrotik.com/t/feature-request-more-web-pages-like-hotspot/48873/1
The basic idea is to have an interface (could be a loopback - an empty bridge with no ports in it but an IP address assigned) and run a Hotspot on that interface. You can then put arbitrary HTML into that Hotspot directory and load it from anywhere.

The rest of it would look a lot like the payment reminders documented here: http://wiki.mikrotik.com/wiki/Payment_Reminders

So to sum it up: first create a loopback interface and run a Hotspot on it.

/interface bridge
add name=loopback0
/ip address
add address=172.31.255.255/32 interface=loopback0
/ip hotspot
add interface=loopback0 name=loopback-hotspot profile=default

Then upload any HTML to the directory created for this purpose (you’ll see it in the file system, the folder name is taken from the ‘html-directory’ parameter of the profile found under “/ip hotspot profile”, which is referenced by the Hotspot instance in “/ip hotspot”. Let’s assume you uploaded troubleshooting.html, and the directory is called ‘hotspot’.
Then configure the proxy to redirect to that resource, and redirect all HTTP traffic coming into ether1 to the proxy.

/ip proxy set port=8081
/ip proxy access
add action=allow local-port=8081 disabled=no dst-address=172.31.255.255
add action=deny local-port=8081 disabled=no redirect-to="http://172.31.255.255/hotspot/troubleshooting.html"
/ip firewall nat
add chain=dstnat in-interface=ether1 protocol=tcp dst-port=80,81,88,8080,8888 action=redirect to-ports=8081 comment="redirect if radio is down"

Then adjust your scripts to enable the NAT rule when the radio is down:

/ip firewall nat { enable [find comment="redirect if radio is down"] };

And disable it again when the radio is up:

/ip firewall nat { disable [find comment="redirect if radio is down"] };

That should do it. Completely untested, though.

Doing it like that will work. I wonder if my rb133c will handle a hotspot. Hrm.. I will have to think I want to do this. Maybe I will test this out. Thanks for your help. I will let you know if I do it and how it works.

The Hotspot won’t be much load because there’ll be no actual packets ever going through it because it runs on a loopback. There’s no traffic generated from behind the loopback, so the Hotspot is 100% idle (there’s just some overhead with the NAT/filter rules it introduces, but that should be minimal). You’re just exploiting the Hotspot for its web server capabilities.

Alright sounds good. I am in a week or so I will try to do this.

ok I got everything to work but the page I want to display from the mikrotik. I tried editing:

hotspot/login.html
hotspot/error.html

When I edit those pages, no matter what I do it will not load the html from those files. If I reset the mikrotik and use the hotspot setup tool then it loads my edited pages. How can I set this up with out using the hotspot setup tool. Do you have an idea?

I ran into the same issue; did you find a solution?