ROS限制單機鏈接數TCP2UDP

統計客戶機鏈接數
:global ipnetmask "192.168.100."tcp

#內網IP起止ide

:for aaa from 1 to 200 do={ip

:global s 0get

:global e 0it

:foreach a in=[/ip firewall connection find src-address~($ipnetmask . $aaa)] do={io

:if ([/ip firewall connection get $a protocol]="tcp") do={class

:set s ($s+1)}foreach

:if ([/ip firewall connection get $a protocol]="udp") do={udp

:set e ($e+1)}統計

}#輸出到LOG顯示:log info ($ipnetmask . $aaa . " tcp=" . $s . " udp=" . $e)}#輸出到控制檯顯示:put ($ipnetmask . $aaa . " tcp=" . $s . " udp=" . $e)}

相關文章
相關標籤/搜索