Community discussions

MikroTik App
 
ahmeqas
just joined
Topic Author
Posts: 1
Joined: Tue Jul 27, 2021 11:39 pm

Hotspot User Profile login and logout script

Tue Jul 27, 2021 11:51 pm

Hi,

I am using RB750Gr3 OS version 6.46.2. I have added commands in On Login and On Logout Script sections under Hotspot User Profile. Purpose is to add the IP address in Firewall Address Lists at user login and remove it on logout. These address lists are used for connection and packet marking to be used for Queue Tree Bandwidth management. As I have allowed a single username and password to be used for 5 devices but all five devices should use bandwidth allocated to a single user account. All five IPs are added in an address list with the name of username of an account. Commands are as below;

Login:
/ip firewall address-list add list=$user address=$address comment=[:put "uid$"mac-address""]

Logout:
/ip firewall address-list remove [find where comment=[:put "uid$"mac-address""]]

My findings:
I have to use the device MAC address as comment and use this comment to delete the entry on logout so that all IPs should not get deleted if a user gets logout on one device. MAC address cannot be used as comment unless added with some text e.g uid otherwise, it never adds an IP in firewall address list. This system is working as expected except one issue stated below.

My issue is:

Sometimes, it does not add IP address of a user in the address list. However, under Log, it shows address list entry added or address list entry removed.

May someone please help me in this regard?

Who is online

Users browsing this forum: wirelesslywired and 15 guests