Community discussions

just joined
Topic Author
Posts: 1
Joined: Tue Oct 30, 2018 5:59 pm

Help with a script to create dynamic pool

Tue Oct 30, 2018 6:05 pm

Hello friends,
  I am trying to create a script in which I keep a series of ip in a variable array and then create a pool for my dhcp server to assign them to the users based on the virtual wlan that are connected at that moment to my internet provider via Wirless .
  Specifically the idea that I came up with which I am implementing was to go through all the virtual wlan I have, verify that they are connected to my provider's AP, and if they are connected, I save an ip in a variable array and then use that array to create the pool to my dhcpserver
The issue is that I can not understand how to use array in routers and I could not put the script to work because I do not know how to add values to the array and then how to display them in ranges = $a.

Code: Select all

:local a;
:for counter=n from=1 to=30 do={
/interface wireless monitor "wlan$n" once do={
:if ($"status" = "connected-to-ess" && $"ssid"="WIFI_ISP" && $"authenticated-clients"="1") do={
## Here I want to go assigning my variable array $a to the ip that I want to put in the pool of the dhcp based on the wlan that are connected
($a, 192.168.88.$n)
/ip pool remove name=dhcp_pool1;
/ip pool add name=dhcp_pool1 ranges=$a; #here I want that ranges have all the ip that has my variable $a

Who is online

Users browsing this forum: No registered users and 13 guests