So Im trying to make a script hat after the user logs in here IP address gets added inot he firewall/address list. I cant seem to find or figure out wthat i use to get there current IP address at login
Im guessing I need a global variable to assign the ip to just not sure the cmd to get the ip
#delay script
/delay 10s
:global hotspotip [not sure wht goes here]
/ip firewall address-list add list=LoggedIn address=hotspotip
Thanks
So this is what I came up with but not working
:global username [/ip hotspot active find user=$user];
:global userip [/ip hotspot active get $username address];
/ip firewall address-list add list=LoggedIn address=$userip
Any thoughts
2frogs
April 6, 2018, 11:59pm
3
Under IP>Hotspot>User-Profiles, you can set an address-list there and will do what you are scripting.
2frogs
April 7, 2018, 12:09am
4
But to use script:
/ip firewall address-list add list=LoggedIn address=[/ip hotspot active find address]
That first answer is probably perfect but the second will probably help me as well since after they timeout I want to remove them from this list.
Thanks
2frogs
April 7, 2018, 1:05am
6
With this method the address-list entry will be removed automatically when the user logs out.
So I have made some progress. I have the on login portion script working how i want it does exactly what I need.
/delay 5s
/ip firewall address-list add list=LoggedIn address=$address comment=$address
However on logout it just deletes all my entries in the address list.
/ip firewall address-list remove [find comment=“$address”]
As you can see i was hopping doing a comment would help but no difference.
Well hit it enough and looks like this did it for meon logout
/ip firewall address-list remove [find comment=“$“mac-address””]