统计客户机连接数 :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)}