統計客戶機連接數
:global ipnetmask "192.168.100."
#內網IP起止
:for aaa from 1 to 200 do={
:global s 0
:global e 0
:foreach a in=[/ip firewall connection find src-address~($ipnetmask . $aaa)] do={
:if ([/ip firewall connection get $a protocol]="tcp") do={
:set s ($s+1)}
:if ([/ip firewall connection get $a protocol]="udp") do={
:set e ($e+1)}
}
#輸出到LOG顯示
:log info ($ipnetmask . $aaa . " tcp=" . $s . " udp=" . $e)}
#輸出到控制檯顯示
:put ($ipnetmask . $aaa . " tcp=" . $s . " udp=" . $e)}