[admin@kirilka] /ip firewall filter> print Flags: X - disabled, I - invalid, D - dynamic 0 chain=input action=accept protocol=tcp src-address-list=white_list_ssh in-interface=ether1 dst-port=22
chain=input action=add-src-to-address-list protocol=icmp address-list=ICMP_SSH_98_stage1 address-list-timeout=1m in-interface=ether2 packet-size=98
A packet of 98 bytes using the ICMP protocol, we put the outgoing address in the ICMP_SSH_98_stage1 sheet
chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_98_stage1 address-list=ICMP_SSH_98_stage2 address-list-timeout=1m in-interface=ether2 packet-size=98
The packet is 98 bytes in size by the ICMP protocol and the outgoing address is already contained in the ICMP_SSH_98_stage1 sheet, then we put the outgoing address in the ICMP_SSH_98_stage2 sheet
chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_98_stage2 address-list=ICMP_SSH_128_stage1 address-list-timeout=1m in-interface=ether1 packet-size=128
The packet is 128 bytes in size by the ICMP protocol and the outgoing address is already contained in the ICMP_SSH_98_stage2 sheet, then we put the outgoing address in the ICMP_SSH_128_stage1 sheet
chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_128_stage1 address-list=white_list_ssh address-list-timeout=1h in-interface=ether1 packet-size=128
The packet is 128 bytes in size by the ICMP protocol and the outgoing address is already contained in the ICMP_SSH_128_stage1 sheet, then we put the outgoing address in the white_list_ssh sheet for 1 hour.
[admin@kirilka] /ip firewall filter> print Flags: X - disabled, I - invalid, D - dynamic 0 chain=input action=accept protocol=tcp src-address-list=white_list_ssh in-interface=ether2 dst-port=22 1 chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_128_stage1 address-list=white_list_ssh address-list-timeout=1h in-interface=ether1 packet-size=128 2 chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_98_stage2 address-list=ICMP_SSH_128_stage1 address-list-timeout=1m in-interface=ether1 packet-size=128 3 chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_98_stage1 address-list=ICMP_SSH_98_stage2 address-list-timeout=1m in-interface=ether1 packet-size=98 4 chain=input action=add-src-to-address-list protocol=icmp address-list=ICMP_SSH_98_stage1 address-list-timeout=1m in-interface=ether1 packet-size=98
[admin@kirilka] /ip firewall filter> print Flags: X - disabled, I - invalid, D - dynamic 0 chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_128_stage1 address-list=plsdelme address-list-timeout=1m in-interface=ether1 packet-size=128 1 chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_98_stage2 address-list=ICMP_SSH_128_stage1 address-list-timeout=1m in-interface=ether1 packet-size=128 2 chain=input action=add-src-to-address-list protocol=icmp src-address-list=ICMP_SSH_98_stage1 address-list=ICMP_SSH_98_stage2 address-list-timeout=1m in-interface=ether1 packet-size=98 3 chain=input action=add-src-to-address-list protocol=icmp address-list=ICMP_SSH_98_stage1 address-list-timeout=1m in-interface=ether1 packet-size=98
:local wlist "plsdelme"; :local tmp ""; :local tmp1 ""; :if ( [/ip firewall address-list find ] != "") do={ :foreach i in [/ip firewall address-list find list=$wlist] do={ :set tmp [/ip firewall address-list get $i address]; :foreach x in [/ip firewall address-list find list~"blacklist"] do={ :set tmp1 [/ip firewall address-list get $x address]; :if ( $tmp1 = $tmp) do={ /ip firewall address-list remove $x; } } } }
Source: https://habr.com/ru/post/186488/
All Articles