Community discussions

MikroTik App
 
baddah
newbie
Topic Author
Posts: 27
Joined: Wed May 31, 2006 4:36 pm
Location: Cape Town,South Africa

Hard Cap Users?

Mon Jul 17, 2006 8:45 am

Hi,is there an easy way to hard cap users on a mikrotik user.All Usage for our users gets saved on a MySQL database,so if a script can acess data from their and implement a hard cap solution it would be ideal,but any other solution(maybe with queus),would be ok as well.Any suggestions.Thanks
 
baddah
newbie
Topic Author
Posts: 27
Joined: Wed May 31, 2006 4:36 pm
Location: Cape Town,South Africa

Wed Aug 16, 2006 11:25 am

Any ideas???without using a full radius server setup.I'm using accounting collecter,so i'd like to keep my Mysql database in that form rather than using an radius setup.Any help would really be apreciated,I need to hard cap people but i'm having some trouble!!

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

Wed Aug 16, 2006 11:32 am

RADIUS can use SQL DB as a back-end.
 
baddah
newbie
Topic Author
Posts: 27
Joined: Wed May 31, 2006 4:36 pm
Location: Cape Town,South Africa

Wed Aug 16, 2006 12:54 pm

thanks for the reply...

Ja I know the radius server has got the MySQL backend,but then i'll have to configure the freeradius and configure all the clients their,and thats just a bit of a big mission at the moment.I thought maybe there some sort of automated script you can use to do this sort of thing,but it seems not??
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Wed Aug 16, 2006 1:59 pm

you could do it via ssh provided you have dedicated host to run the script.
 
baddah
newbie
Topic Author
Posts: 27
Joined: Wed May 31, 2006 4:36 pm
Location: Cape Town,South Africa

Wed Aug 16, 2006 4:29 pm

not sure how that would work?maybe you can give more info on how that would work?

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

Wed Aug 16, 2006 5:13 pm

a perl or python script running on a linux machine that checks a user against your SQL database. Then the script would log into the router via ssh and issue some CLI commands.

Eugene
 
baddah
newbie
Topic Author
Posts: 27
Joined: Wed May 31, 2006 4:36 pm
Location: Cape Town,South Africa

Thu Aug 17, 2006 9:40 am

Ok,that sounds pretty cool.That's exactly what i was hoping to do,but just a few questions.If you know,otherwise i'll try to figure it out.I know how to do perl mysql interaction,but i'm having some trouble with the following.

1)if i want to ssh into the router from the script,how will i do this.something like a system("ssh xxx.xxx.xxx.xx"), won't work because of password needed.How can i get around this.I know how to do it between linux boxes,but my mikrotik knowledge not that good.

2)What type of command am i looking for to kill the user once,the cap limit is reached?I can't seem to find a command that can do this.

Thanks for the help so far!
 
User avatar
Eugene
Forum Veteran
Forum Veteran
Posts: 986
Joined: Mon May 31, 2004 5:06 pm
Location: Cranfield, UK

Thu Aug 17, 2006 10:22 am

1) use ssh keys. you should generate a key on your linux box with 'ssh-keygen -t dsa' and then import it on the router with '/user ssh-keys import'

2) I think disabling the user record (for HS and PPP) should work.

Eugene
 
baddah
newbie
Topic Author
Posts: 27
Joined: Wed May 31, 2006 4:36 pm
Location: Cape Town,South Africa

Its working mostly

Thu Aug 17, 2006 12:32 pm

Thanks Eugene,you're a legend.

Just sort out all the mysql stuff and it'll work,but that's easy luckily

I'm just limiting the queue to 1byte or something for every user that's over the limit

Thanks

Who is online

Users browsing this forum: rextended and 35 guests