I have the following idea, create a single script that checks with which a given ip User is connected to pppoe, compares with the ip ip firewall access-list and if not listed, add it in the access list.
I managed to create two scripts for this function but still can not connect the two.
First: Checks particular User and add the ip firewall access list with a comment
:foreach ID in=[/ppp active find name=bill] do={
:foreach IP in=[/ppp active get $ID address] do={
:global IP1 $IP;
}
}
}
}
}
Based on this comment the other script checks if there is any ip for him
:foreach i in=[/ip firewall address-list find] do={
:if ( [:find [/ip firewall address-list get $i comment] “bill” ] >= 0 ) do={
:global IP3 [/ip firewall address-list get $i address];
}
}
Would unite the two scripts and compare the results.
If there is no ip access-list in, add, and if there warn that already exists.
I tried but without success so
foreach ID in=[/ppp active find name=bill] do={
:foreach IP in=[/ppp active get $ID address] do={
:global IP1 $IP;
:foreach i in=[/ip firewall address-list find] do={
:if ( [:find [/ip firewall address-list get $i comment] “bill” ] >= 0 ) do={
:global IP2 [/ip firewall address-list get $i address];
The one i posted find all ppp connections by ‘bill’ and it adds the IP-address of these to a address-list names ‘clients’ with the comment ‘bill’ in case the don’t already exists, and logs a message in case they do. I don’t get your third case. Is it to remove entries from the address-list of ppp connection that no longer exists? If not then try to describe in words what you try to achieve.
Let’s assume that ip address and comment bill already exists in ip firewall address-list. If the IP of bill found in /ip firewall address-list is different from that found in /ppp active remove it and add the found in /ppp active
Working with dynamic ips so it may bill username connect different ips.