Page 1 of 1

dhcp lease to firewall

Posted: Sat Apr 11, 2020 12:26 pm
by aceror
Hello
I want to add with script all the dhcp list to the firewall li I do with IP-BINDING (see script) how can I do it? THANKS!!

:foreach ITEM in=[/ip hotspot ip-binding find] do={
:local MAC [/ip hotspot ip-binding get $ITEM mac-address];
:local COMMENT [/ip hotspot ip-binding get $ITEM comment];
/ip firewall filter add chain=forward src-mac-address=$MAC action=drop disabled=yes protocol=tcp place-before=3 comment=$COMMENT
}

Re: dhcp lease to firewall

Posted: Sun Apr 12, 2020 2:37 am
by aceror
Ya lo resolvi

:foreach ITEM in=[/ip dhcp-server lease find dynamic] do={
:local MAC [/ip dhcp-server lease get $ITEM active-mac-address];
:local COMMENT [/ip dhcp-server lease get $ITEM host-name];
/ip firewall filter add chain=forward src-mac-address=$MAC action=drop disabled=yes protocol=tcp place-before=3 comment=$COMMENT
}