ROS防御内网攻击

本策略适用于防范UDP流量攻击(比如阿拉丁UDP攻击器)。TCP连接数攻击限制下单机连接数就行了,我就不多说了。

首先要新建一个网桥,将自己内网卡加入到桥接。

ROS防火墙脚本
  1. /interface bridge settings set use-ip-firewall=yes

  2. /ip firewall filter add action=add-src-to-address-list address-list=att address-list-timeout=10m chain=input connection-rate=10M-4294967295 protocol=udp src-address=192.168.0.0/24

  3. /ip firewall mangle add action=add-src-to-address-list address-list=att address-list-timeout=10m chain=postrouting connection-rate=10M-4294967295 protocol=udp src-address=192.168.0.0/24

修改IP为自己的内网IP地址范围。

ROS计划任务脚本
  1. :global attip

  2. :global defint

  3. :global taa 0

  4. :global nowmonth

  5. :global allmonth jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec

  6. :foreach lizi in=[$allmonth] do={

  7. :if ([:pick [/system clock get date] 0 3]=$lizi) do={

  8. :set nowmonth ($taa+1)}

  9. :set taa ($taa + 1)}

  10. :global atttime ([:pick [/system clock get date] 7 11].$nowmonth.[:pick [/system clock get date] 4 6]."-".[/system clock get time]);

  11. :foreach fatt in=[/ip firewall address-list find list=att] do={

  12. :set attip [/ip firewall address-list get $fatt address]

  13. :if ([/interface bridge nat find arp-dst-address=($attip."/32")]="") do={

  14. /interface bridge nat add action=src-nat arp-dst-address=($attip."/32") chain=srcnat mac-protocol=arp comment=("att-".$atttime)}}

  15. :foreach fattd in=[/interface bridge nat find] do={

  16. :if ([/ip firewall address-list find list=att address=[:pick [/interface bridge nat get $fattd arp-dst-address] 0 ([:len [/interface bridge nat get $fattd arp-dst-address]]-3)]]="") do={

  17. /interface bridge nat remove $fattd}}

设置为定时循环执行,建议间隔时间为3-5秒左右为宜。

本策略原理是将攻击者的IP记录下来,加入攻击者的IP到桥防火墙,攻击者的 IP将在ARP缓存超时后(WIN7系统5次测试计算后得到平均值为20秒左右。)无法和ROS通讯,因为找不到ROS的MAC,包括流量攻击也打不上 来,因为找不到目标。(进入桥防火墙后即使攻击者再手工绑定路由MAC也无法成功。)
缺点:若客户机在攻击前已绑定路由MAC,则防御无法生效。因为ARP缓存不会超时。

不适用为PPPOE用户。切记。