Hi,
I need a script that will watch for ICMP packets per second on an interface and if it exceeds 100pps, it will send an email listing the source and destination IP's for the offending connection.
thanks,
Travis
/ip fire filter
add chain=output
add chain=input protocol=icmp limit=100/1s,2 comment="Allow limited pings"
add chain=input action=add-src-to-address-list protocol=icmp address-list=ICMP_blacklist address-list-timeout=4d comment="list excess pings"
:local last
:foreach ip in [/ip fire filter find chain=icmp_chk comm=icmp_chk] do {:if([/ip firewall address-list find address=[/ip firewall filter get $ip src-address]]="") do {/ip fire filter rem $ip}}
:foreach address in [/ip firewall address-list find list=icmp_temp] do {:if([/ip firewall filter find src-address=[/ip fire address-list get $address address]]="") do {/ip firewall filter add chain=icmp_chk src-address=[/ip fire address-list get $address address] protocol=icmp limit=100/1s,2 comm=icmp_chk}}
:set last [/ip fire filter find chain=icmp_chk comm=last]
:if($last!="") do {/ip fire fil rem $last}
/ip fire filter add chain=icmp_chk comm=last action=add-src-to-address-list protocol=icmp address-list=ICMP_Blacklist address-list-timeout=4d
/system scheduler add name="icmp_scan" on-event=icmp_scan interval=30s comment="Scan ICMP Lists" disabled=no
/ip fire filter add chain=forward protocol=icmp action=add-src-to-address-list protocol=icmp address-list=icmp_temp address-list-timeout=1m comm="List ICMP Packets"
/ip fire filter add chain=forward protocol=icmp action=jump jump-target=icmp_chk comm="Scan ICMP Traffic per host"
:foreach ip in [/ip fire filter find chain=icmp_chk comm=icmp_chk] do {:if([/ip firewall address-list find list="icmp_temp" address=[/ip firewall filter get $ip src-address]]="") do {/ip fire filter rem $ip}}
:foreach address in [/ip firewall address-list find list=icmp_temp] do {
:if([/ip firewall filter find src-address=[/ip fire address-list get $address address]]="") do {
/ip firewall filter add chain=icmp_chk src-address=[/ip fire address-list get $address address] protocol=icmp limit=100/1s,2 comm=icmp_chk
/ip firewall filter add chain=icmp_chk src-address=[/ip fire address-list get $address address] comm=icmp_chk action=add-src-to-address-list protocol=icmp address-list=ICMP_Blacklist address-list-timeout=4d
}
}
/system scheduler add name="icmp_scan" on-event=icmp_scan interval=30s comment="Scan ICMP Lists" disabled=no
/ip fire filter add chain=forward protocol=icmp action=add-src-to-address-list address-list=icmp_temp address-list-timeout=1m comm="List ICMP Packets"
/ip fire filter add chain=forward protocol=icmp action=jump jump-target=icmp_chk comm="Scan ICMP Traffic per host"