Community discussions

MikroTik App
 
gustavomam
Trainer
Trainer
Topic Author
Posts: 287
Joined: Tue Jul 23, 2013 6:29 pm
Location: Spain
Contact:

Capsman registration identify with dhcp lease comment

Mon Apr 17, 2017 1:12 pm

Hi everyone.

This weekend i was working in a script that someone asked in the forum, i couldn't find the topic, so here you have

Is useful to know who is connect in which access point in Capsman. Capsman only shows mac-address, so this script search this mac-adress in dhcp-lease and create an access-list whit the mac and the same comment in DHCP. The result you will see in registration table the name that you have already set in static dhcp-lease list.

You can schedule this script for example each 4 hours, if someone new is connect (and you have it static dhcp lease) it will be add it. Be careful to make it often, remember each time you add some entry in access-list, your capsman will disconnect for a few seconds all clients and them they will connect again.
:local maccaps
:local macdhcp
:local name
:foreach i in=[/caps-man registration-table find ] do={
	:set maccaps ( [/caps-man registration-table get value-name=mac-address number=$i])
	:foreach j in=[/ip dhcp-server lease find ] do={
		:set macdhcp ( [/ip dhcp-server lease get value-name=mac-address number=$j])
		:set name [/ip dhcp-server lease get [find where mac-address=$macdhcp] comment ] 
		:if ($maccaps = $macdhcp ) do={
		/caps-man access-list disable [find mac-address=$macdhcp]
		/caps-man access-list add mac-address=$macdhcp comment=$name
		}
		}	
	}
/caps-man access-list remove [find where disabled]
Please test it and give me your comments.
 
freemannnn
Forum Veteran
Forum Veteran
Posts: 700
Joined: Sun Oct 13, 2013 7:29 pm

Capsman registration identify with dhcp lease comment

Mon Apr 17, 2017 6:55 pm

If you give identity to your caps and in provision menu you use identity as prefix, whats the point of that script? In registration tab you can see who is where connected!
I always give static names to caps (like reception, mainbar, pool) and not let them as caps1, caps2, caps3 etc. that way i know which cap is down or who is connected where.
 
gustavomam
Trainer
Trainer
Topic Author
Posts: 287
Joined: Tue Jul 23, 2013 6:29 pm
Location: Spain
Contact:

Re: Capsman registration identify with dhcp lease comment

Mon Apr 17, 2017 9:46 pm

Hi.

Maybe you don't undearstand my point. I don't rename the CAPs, i only use comment of lease to comment wich device is connected in CAPs.

Here you have some pictures to ilustrate my script.
Image
Image
 
freemannnn
Forum Veteran
Forum Veteran
Posts: 700
Joined: Sun Oct 13, 2013 7:29 pm

Re: Capsman registration identify with dhcp lease comment

Mon Apr 17, 2017 10:28 pm

aaaa ok now i understand
 
grantmu
just joined
Posts: 4
Joined: Mon Mar 19, 2018 10:14 pm

Re: Capsman registration identify with dhcp lease comment

Thu Sep 13, 2018 3:21 pm

I have CAPS man setup with multiple SSID all working fine. Now want to add the users of each SSID to an address list.
So I wanted to query the registration table but there does not seem to be a field for SSID.
EG: SSID one = Managers
SSID two= Workers.
Each SSID has its own DHCP to allocate IP addresses.
dhcp1=managers
dhcp2 = workers

Want to create and add any ip address of users login on through the managers SSID into an address list called managers_list. And the same for the workers SSID to workers_list
Anyone have any idea how to get this right.

Grant
 
gramels
just joined
Posts: 17
Joined: Thu Aug 14, 2014 11:28 am

Re: Capsman registration identify with dhcp lease comment

Mon Nov 26, 2018 1:04 pm

Hi Gustave,

The screenshots are not shown here any more, can you upload them again?

Do I understand correct:

This script copies the DHCP lease comment to the caps access list comment?
It seems not to work for me with 6.43.4 .
I get a "invalid internal item number" errror.

Cheers
-gramels
 
rpsnetwork
just joined
Posts: 1
Joined: Sat Dec 15, 2018 4:00 am

Re: Capsman registration identify with dhcp lease comment

Sat Dec 15, 2018 7:41 am

Hi everyone.

This weekend i was working in a script that someone asked in the forum, i couldn't find the topic, so here you have

Is useful to know who is connect in which access point in Capsman. Capsman only shows mac-address, so this script search this mac-adress in dhcp-lease and create an access-list whit the mac and the same comment in DHCP. The result you will see in registration table the name that you have already set in static dhcp-lease list.

You can schedule this script for example each 4 hours, if someone new is connect (and you have it static dhcp lease) it will be add it. Be careful to make it often, remember each time you add some entry in access-list, your capsman will disconnect for a few seconds all clients and them they will connect again.
:local maccaps
:local macdhcp
:local name
:foreach i in=[/caps-man registration-table find ] do={
	:set maccaps ( [/caps-man registration-table get value-name=mac-address number=$i])
	:foreach j in=[/ip dhcp-server lease find ] do={
		:set macdhcp ( [/ip dhcp-server lease get value-name=mac-address number=$j])
		:set name [/ip dhcp-server lease get [find where mac-address=$macdhcp] comment ] 
		:if ($maccaps = $macdhcp ) do={
		/caps-man access-list disable [find mac-address=$macdhcp]
		/caps-man access-list add mac-address=$macdhcp comment=$name
		}
		}	
	}
/caps-man access-list remove [find where disabled]
Please test it and give me your comments.
Thank.. Work it for ME

Who is online

Users browsing this forum: No registered users and 18 guests