Community discussions

MikroTik App
 
ajmal
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 58
Joined: Mon Jan 31, 2005 8:38 pm
Location: IN

reminder mesage

Wed Mar 09, 2005 5:37 pm

hi

i have mikrotik router ver 2.8 and have to generate pop up for the clients when clients 90% of package have been used.
is it possible, if yes please let me know the scripts

(both the case hourly and data transfer based package)
 
User avatar
djape
Member
Member
Posts: 469
Joined: Sat Nov 06, 2004 7:54 pm
Location: Serbia

Tue Mar 15, 2005 10:57 pm

Well, you can't do something like that with MT, sorry...
 
tully
MikroTik Support
MikroTik Support
Posts: 505
Joined: Fri May 28, 2004 11:07 am

Wed Mar 16, 2005 10:36 am

We will have a feature (most likely in v2.9) that allows you to redirect any http request after x minutes or every x minutes...

This will be for the free hotspots...

John
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 993
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Wed Mar 16, 2005 3:10 pm

Well, actually, you can 8)
First of all, you will need such a message to sit in the virtual root on some IP addres, i.e.: http://someIPaddress:someport/ should pop-up your message.

Then, refer to the following thread to set up the data transfer package system:
http://forum.mikrotik.com//viewtopic.php?t=308
Note, that you should slightly modify the logging script:
:local sum; :local traf;
:set sum 0
/ip firewall rule accounting{
:foreach i in [find] do={:incr sum}
:for i from=1 to=$sum do={
:set traf [get [find comment=("user" . $i)]
bytes]
:set traf ($traf/1073741824*100)
:if ($traf>90) do={/ip firewall dst-nat add limit-count=1 limit-time=356d dst-port=80 protocol=tcp action=nat to-dst-address=<someIPaddress> to-dst-port=<someport> src-address=[get [find comment=("user" . $i)]dst-address]
:log facility=System-Info message=("user" . $i .
" exceeded 90% of 1Gb limit!")}
}
} 
Tout individu a droit à la vie, à la liberté et à la sûreté de sa personne.
 
User avatar
djape
Member
Member
Posts: 469
Joined: Sat Nov 06, 2004 7:54 pm
Location: Serbia

Thu Mar 17, 2005 6:31 pm

Hehe, Eugene, you devil ;)

Nice to see that you guys watch our threads...

Cheers...
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 993
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Thu Mar 17, 2005 6:35 pm

Devil is lived spelled backwards :twisted:
Tout individu a droit à la vie, à la liberté et à la sûreté de sa personne.
 
ajmal
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 58
Joined: Mon Jan 31, 2005 8:38 pm
Location: IN

Thu Mar 24, 2005 6:30 am

Thax Eugene
 
GJS
Member
Member
Posts: 418
Joined: Sat May 29, 2004 4:07 pm
Location: London

Fri Mar 25, 2005 8:38 pm

Hmm...this is a good idea but won't this arrangement block all http access to the user once he has reached 90%? How do you 'undo' the dst-nat rule once the user has seen his message?
Guy

wispuk.org
A Forum Community for UK WISPs
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 993
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Tue Mar 29, 2005 3:37 pm

limit-count=1
The rule will match only once.
Tout individu a droit à la vie, à la liberté et à la sûreté de sa personne.
 
User avatar
surfnet
Member Candidate
Member Candidate
Posts: 253
Joined: Wed Sep 01, 2004 6:38 pm

Thu Jul 21, 2005 6:43 am

I tried to use this method to redirect people that have not paid thier monthly bill

I give them a static IP in 192.168.66.x range and then mangle those packets with a mark called del

add chain=dstnat src-address=192.168.66.0/24 protocol=tcp dst-port=80 \
packet-mark=del action=dst-nat to-addresses=66.x.x.35 to-ports=80

I can see in Torch that It send packets out to 66.x.x.35, but none ever return.

any ideas?
Ken
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 993
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Thu Jul 21, 2005 12:35 pm

You need a properly configured web server on 66.x.x.35, as I mentioned before.
Tout individu a droit à la vie, à la liberté et à la sûreté de sa personne.
 
User avatar
surfnet
Member Candidate
Member Candidate
Posts: 253
Joined: Wed Sep 01, 2004 6:38 pm

Thu Jul 21, 2005 5:29 pm

It is a properly configured website. When I looked at torch without the rule on, I noticed the since I am using a hotspot that I have a transparent http proxy and all http trafffic goes throught the hotpsot proxy address, I think I need to apply my rule after the proxy?
Ken
 
User avatar
sten
Forum Veteran
Forum Veteran
Posts: 920
Joined: Tue Jun 01, 2004 12:10 pm

Thu Jul 21, 2005 7:11 pm

Is the no-virtualhost webserver configured correctly to serve a website or is it correctly configured to handle redirections? 8)
 
User avatar
surfnet
Member Candidate
Member Candidate
Posts: 253
Joined: Wed Sep 01, 2004 6:38 pm

Thu Jul 21, 2005 7:58 pm

hmm it is a virtual server..I have a webserver that I can remove all virtual serverss

http://66.151.140.2

Ill try it and report back
Ken
 
User avatar
infomate
Member Candidate
Member Candidate
Posts: 112
Joined: Sat May 21, 2005 2:30 pm
Location: Dumaguete City, Philippines

Sun Jul 24, 2005 6:45 am

mean time that you guys are at it, Eugene can you also be so kind enough to share the code for users reaching 90% of their time limit (up-time fro pre-paid users).

A lot of us would love to have this feature on their hotspot setups.

thasnk you.

Robert S.
 
User avatar
infomate
Member Candidate
Member Candidate
Posts: 112
Joined: Sat May 21, 2005 2:30 pm
Location: Dumaguete City, Philippines

Sun Jul 24, 2005 6:52 am

BTW, Eugene, can the
http://someIPaddress:someport/
be placed on the /hotspot folder? or somewhere else?

If my hotspot is on 10.5.50.1, then should the address of the reminder be:
"http://10.5.50.1/remider.html" just like all the other default MT webpages?
 
User avatar
surfnet
Member Candidate
Member Candidate
Posts: 253
Joined: Wed Sep 01, 2004 6:38 pm

Sun Jul 24, 2005 7:10 am

so I set the dst-nat rule to goto 66.151.140.2 and have no luck..any ideas?

If I set the login page to redirect to my web server it works, so I know the web server is correct, I fell like I have a rule issue.
Ken
 
User avatar
sten
Forum Veteran
Forum Veteran
Posts: 920
Joined: Tue Jun 01, 2004 12:10 pm

Mon Jul 25, 2005 12:55 am

Perhaps-error- redirection on the web server isnt working properly?
It should redirect to the redirection html file you want to display if user is trying to access something that doesnt exist. (This will create a funky loops if your webpage is incomplete, btw).
You also want to add a redirect on the index.html file to point to index2.html on 0 seconds depending on what result you want.

Maybe you need to white-list the server?
After the initial redirection done by the routeros gateway you have to make the client realize that it must speak with the server directly (it's not a permanent redirection, now is it?)

It's been 5 years since i did this so i might have forgotten a detail or two.
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 993
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Wed Jul 27, 2005 9:57 am

Assuming the code above works, and I hope you'll forgive me this presumption,:wink: you need to check your web server configuration. It should give the warning page to any (that's important) HTTP GET request. Try to telnet to the port your web server is listening on and issue an arbitrary GET request. This should display the warning page.


2infomate:
Yes, it can, but it's certainly not a supported configuration :wink:
Tout individu a droit à la vie, à la liberté et à la sûreté de sa personne.
 
User avatar
surfnet
Member Candidate
Member Candidate
Posts: 253
Joined: Wed Sep 01, 2004 6:38 pm

Wed Jul 27, 2005 6:07 pm

ok here is my telnet to my webserver

here is my rule

note:.. since I am on rc7 and using hotspot, I had to figure out that since the web proxy is on I had to not look for port 80, but port 64874

When I use 80, it never works.

add chain=dstnat src-address=192.168.66.0/24 protocol=tcp dst-port=64874 \
packet-mark=del action=dst-nat to-addresses=66.151.140.2 to-ports=64874 \
comment="" disabled=no


telnet 66.151.140.2 80


HTTP/1.1 400 Bad Request
Server: Microsoft-IIS/5.0
Date: Wed, 27 Jul 2005 15:04:58 GMT
Content-Type: text/html
Set-Cookie: EGSOFT_ID=64.74.213.85-2386335888.29725372; expires=Fri, 31-Dec-2010 00:00:00 GMT; path=/
Content-Length: 87

<html><head><title>Error</title></head><body>The parameter is incorrect. </body></html>

Connection to host lost.
Ken
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 993
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Thu Jul 28, 2005 11:20 am

You haven't typed any GET request while you should type one.
GET /<some page you want to get> HTTP/1.0
Tout individu a droit à la vie, à la liberté et à la sûreté de sa personne.
 
User avatar
surfnet
Member Candidate
Member Candidate
Posts: 253
Joined: Wed Sep 01, 2004 6:38 pm

Thu Jul 28, 2005 5:12 pm

ok
GET /del.htm HTTP/1.0
So does this now mean my webserver is setup correclty?

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
X-Powered-By: ASP.NET
Date: Thu, 28 Jul 2005 14:11:39 GMT
Content-Type: text/html
Accept-Ranges: bytes
Last-Modified: Thu, 28 Jul 2005 14:10:01 GMT
ETag: "104535b7e93c51:956"
Set-Cookie: EGSOFT_ID=64.74.213.85-1169650464.29725566; expires=Fri, 31-Dec-2010 00:00:00 GMT; path=/
Content-Length: 144

<html>

<head>
<title>Pay Your Bill</title>
</head>

<body>

<p><b><font size="7">Pay Your Bill!!</font></b></p>

</body>

</html>


Connection to host lost.
Ken

Who is online

Users browsing this forum: No registered users and 17 guests