热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

RouterOS官方防火墙脚本

文章标题:RouterOS官方防火墙脚本。Linux是中国IT实验室的一个技术频道。包含桌面应用,Linux系统管理,内核研究,嵌入式系统和开源等一些基本分类
/ ip firewall connection tracking
set enabled=yes tcp-syn-sent-timeout=1m tcp-syn-received-timeout=1m \
  tcp-established-timeout=1d tcp-fin-wait-timeout=10s \
  tcp-close-wait-timeout=10s tcp-last-ack-timeout=10s \
  tcp-time-wait-timeout=10s tcp-close-timeout=10s udp-timeout=10s \
  udp-stream-timeout=3m icmp-timeout=10s generic-timeout=10m
/ ip firewall filter
add chain=input connection-state=established action=accept comment="accept \
  established connection packets" disabled=no
add chain=input connection-state=related action=accept comment="accept related \

  connection packets" disabled=no
add chain=input connection-state=invalid action=drop comment="drop invalid \
  packets" disabled=no
add chain=input protocol=tcp psd=21,3s,3,1 action=drop comment="detect and \
  drop port scan connections" disabled=no
add chain=input protocol=tcp connection-limit=3,32 src-address-list=black_list \

  action=tarpit comment="suppress DoS attack" disabled=no
add chain=input protocol=tcp connection-limit=10,32 \
  action=add-src-to-address-list address-list=black_list \
  address-list-timeout=1d comment="detect DoS attack" disabled=no
add chain=input dst-address-type=!local action=drop comment="drop all that is \
  not to local" disabled=no
add chain=input src-address-type=!unicast action=drop comment="drop all that \
  is not from unicast" disabled=no
add chain=input protocol=icmp action=jump jump-target=ICMP comment="jump to \
  chain ICMP" disabled=no
add chain=input action=jump jump-target=services comment="jump to chain \
  services" disabled=no
add chain=input action=log log-prefix="input" comment="" disabled=yes
add chain=input action=drop comment="drop everything else" disabled=no
add chain=ICMP protocol=icmp icmp-optiOns=0:0-255 limit=5,5 action=accept \
  comment="0:0 and limit for 5pac/s" disabled=no
add chain=ICMP protocol=icmp icmp-optiOns=3:3 limit=5,5 action=accept \
  comment="3:3 and limit for 5pac/s" disabled=no
add chain=ICMP protocol=icmp icmp-optiOns=3:4 limit=5,5 action=accept \
  comment="3:4 and limit for 5pac/s" disabled=no
add chain=ICMP protocol=icmp icmp-optiOns=8:0-255 limit=5,5 action=accept \
  comment="8:0 and limit for 5pac/s" disabled=no
add chain=ICMP protocol=icmp icmp-optiOns=11:0-255 limit=5,5 action=accept \
  comment="11:0 and limit for 5pac/s" disabled=no
add chain=ICMP protocol=icmp action=drop comment="Drop everything else" \
  disabled=no
add chain=services src-address=127.0.0.1 dst-address=127.0.0.1 action=accept \
  comment="accept localhost" disabled=no
add chain=services protocol=tcp dst-port=20-21 action=accept comment="allow \
  ftp" disabled=no
add chain=services protocol=tcp dst-port=22 action=accept comment="allow sftp, \

  ssh" disabled=no
add chain=services protocol=tcp dst-port=23 action=accept comment="allow \
  telnet" disabled=no
add chain=services protocol=tcp dst-port=80 action=accept comment="allow http, \

  webbox" disabled=no
add chain=services protocol=tcp dst-port=8291 action=accept comment="Allow \
  winbox" disabled=no
add chain=services protocol=udp dst-port=20561 action=accept comment="allow \
  MACwinbox " disabled=no
add chain=services src-address=159.148.172.205 protocol=tcp dst-port=7828 \
  action=accept comment="..." disabled=no
add chain=services protocol=tcp dst-port=2000 action=accept comment="Bandwidth \

  server" disabled=yes
add chain=services protocol=udp dst-port=5678 action=accept comment=" MT \
  Discovery Protocol" disabled=yes
add chain=services protocol=tcp dst-port=53 action=accept comment="allow DNS \
  request" disabled=yes
add chain=services protocol=udp dst-port=53 action=accept comment="Allow DNS \
  request" disabled=yes
add chain=services protocol=udp dst-port=1701 action=accept comment="allow \
  L2TP" disabled=yes
add chain=services protocol=tcp dst-port=1723 action=accept comment="allow \
  PPTP" disabled=yes
add chain=services protocol=gre action=accept comment="allow PPTP and EoIP" \
  disabled=yes
add chain=services protocol=ipencap action=accept comment="allow IPIP" \
  disabled=yes
add chain=services protocol=udp dst-port=1900 action=accept comment="UPnP" \
  disabled=yes
add chain=services protocol=tcp dst-port=2828 action=accept comment="UPnP" \
  disabled=yes
add chain=services protocol=udp dst-port=67-68 action=accept comment="allow \
  DHCP" disabled=yes
add chain=services protocol=tcp dst-port=8080 action=accept comment="allow Web \

  Proxy" disabled=yes
add chain=services protocol=tcp dst-port=123 action=accept comment="allow NTP" \

  disabled=yes
add chain=services protocol=tcp dst-port=161 action=accept comment="allow \
  SNMP" disabled=yes
add chain=services protocol=tcp dst-port=443 action=accept comment="allow \
  https for Hotspot" disabled=yes
add chain=services protocol=tcp dst-port=1080 action=accept comment="allow \
  Socks for Hotspot" disabled=yes
add chain=services protocol=udp dst-port=500 action=accept comment="allow \
  IPSec connections" disabled=yes
add chain=services protocol=ipsec-esp action=accept comment="allow IPSec" \
  disabled=yes
add chain=services protocol=ipsec-ah action=accept comment="allow IPSec" \
  disabled=yes
add chain=services protocol=tcp dst-port=179 action=accept comment="Allow BGP" \

  disabled=yes
add chain=services protocol=udp dst-port=520-521 action=accept comment="allow \
  RIP" disabled=yes
add chain=services protocol=ospf action=accept comment="allow OSPF" \
  disabled=yes
add chain=services protocol=udp dst-port=5000-5100 action=accept \
  comment="allow BGP" disabled=yes
add chain=services protocol=tcp dst-port=1720 action=accept comment="allow \
  Telephony" disabled=yes
add chain=services protocol=udp dst-port=1719 action=accept comment="allow \
  Telephony" disabled=yes
add chain=services protocol=vrrp action=accept comment="allow VRRP " \
  disabled=yes
add chain=virus protocol=tcp dst-port=135-139 action=drop comment="Drop \
  Blaster Worm" disabled=no
add chain=virus protocol=udp dst-port=135-139 action=drop comment="Drop \
  Messenger Worm" disabled=no
add chain=virus protocol=tcp dst-port=445 action=drop comment="Drop Blaster \
  Worm" disabled=no
add chain=virus protocol=udp dst-port=445 action=drop comment="Drop Blaster \
  Worm" disabled=no
add chain=virus protocol=tcp dst-port=593 action=drop comment="________" \
  disabled=no
add chain=virus protocol=tcp dst-port=1024-1030 action=drop comment="________" \

  disabled=no
add chain=virus protocol=tcp dst-port=1080 action=drop comment="Drop MyDoom" \
  disabled=no
add chain=virus protocol=tcp dst-port=1214 action=drop comment="________" \
  disabled=no
add chain=virus protocol=tcp dst-port=1363 action=drop comment="ndm requester" \

  disabled=no
add chain=virus protocol=tcp dst-port=1364 action=drop comment="ndm server" \
  disabled=no
add chain=virus protocol=tcp dst-port=1368 action=drop comment="screen cast" \
  disabled=no
add chain=virus protocol=tcp dst-port=1373 action=drop comment="hromgrafx" \
  disabled=no
add chain=virus protocol=tcp dst-port=1377 action=drop comment="cichlid" \
  disabled=no
add chain=virus protocol=tcp dst-port=1433-1434 action=drop comment="Worm" \
  disabled=no
add chain=virus protocol=tcp dst-port=2745 action=drop comment="Bagle Virus" \
  disabled=no
add chain=virus protocol=tcp dst-port=2283 action=drop comment="Drop Dumaru.Y" \

  disabled=no
add chain=virus protocol=tcp dst-port=2535 action=drop comment="Drop Beagle" \
  disabled=no
add chain=virus protocol=tcp dst-port=2745 action=drop comment="Drop \
  Beagle.C-K" disabled=no
add chain=virus protocol=tcp dst-port=3127-3128 action=drop comment="Drop \
  MyDoom" disabled=no
add chain=virus protocol=tcp dst-port=3410 action=drop comment="Drop Backdoor \
  OptixPro" disabled=no
add chain=virus protocol=tcp dst-port=4444 action=drop comment="Worm" \
  disabled=no
add chain=virus protocol=udp dst-port=4444 action=drop comment="Worm" \
  disabled=no
add chain=virus protocol=tcp dst-port=5554 action=drop comment="Drop Sasser" \
  disabled=no
add chain=virus protocol=tcp dst-port=8866 action=drop comment="Drop Beagle.B" \

  disabled=no
add chain=virus protocol=tcp dst-port=9898 action=drop comment="Drop \
  Dabber.A-B" disabled=no
add chain=virus protocol=tcp dst-port=10000 action=drop comment="Drop \
  Dumaru.Y" disabled=no
add chain=virus protocol=tcp dst-port=10080 action=drop comment="Drop \
  MyDoom.B" disabled=no
add chain=virus protocol=tcp dst-port=12345 action=drop comment="Drop NetBus" \
  disabled=no
add chain=virus protocol=tcp dst-port=17300 action=drop comment="Drop Kuang2" \
  disabled=no
add chain=virus protocol=tcp dst-port=27374 action=drop comment="Drop \
  SubSeven" disabled=no
add chain=virus protocol=tcp dst-port=65506 action=drop comment="Drop PhatBot, \

  Gaobot" disabled=no
add chain=forward connection-state=established action=accept comment="accept \
  established packets" disabled=no
add chain=forward connection-state=related action=accept comment="accept \
  related packets" disabled=no
add chain=forward connection-state=invalid action=drop comment="drop invalid \
  packets" disabled=no
add chain=forward src-address-type=!unicast action=drop comment="drop all that \

  is not from unicast" disabled=no
add chain=forward in-interface=internet src-address-list=not_in_internet \
  action=drop comment="drop data from bogon IP's" disabled=no
add chain=forward in-interface=!internet dst-address-list=not_in_internet \
  action=drop comment="drop data to bogon IP's" disabled=no
add chain=forward protocol=icmp action=jump jump-target=ICMP comment="jump to \
  chain ICMP" disabled=no
add chain=forward action=jump jump-target=virus comment="jump to virus chain" \
  disabled=no
add chain=forward action=accept comment="Accept everything else" disabled=no
add chain=output connection-state=invalid action=drop comment="drop invalid \
  packets" disabled=no
add chain=output connection-state=related action=accept comment="accept \
  related packets" disabled=no
add chain=output connection-state=established action=accept comment="accept \
  established packets" disabled=no
add chain=output action=drop comment="Drop all connections from this router" \
  disabled=no
/ ip firewall address-list
add list=not_in_internet address=0.0.0.0/8 comment="" disabled=no
add list=not_in_internet address=172.16.0.0/12 comment="" disabled=no
add list=not_in_internet address=192.168.0.0/16 comment="" disabled=no
add list=not_in_internet address=10.0.0.0/8 comment="" disabled=no
add list=not_in_internet address=169.254.0.0/16 comment="" disabled=no
add list=not_in_internet address=127.0.0.0/8 comment="" disabled=no
add list=not_in_internet address=224.0.0.0/3 comment="" disabled=no
/ ip firewall service-port
set ftp ports=21 disabled=no
set tftp ports=69 disabled=no
set irc ports=6667 disabled=no
set h323 disabled=yes
set quake3 disabled=no
set mms disabled=no
set gre disabled=yes
set pptp disabled=yes

推荐阅读
  • 介绍一款好用的内网穿透工具FRP
    本文介绍了一款好用的内网穿透工具FRP,它是一个使用Go语言开发的高性能的反向代理应用。FRP支持多种协议类型,并且可以根据域名进行路由转发。 ... [详细]
  • 本文由编程笔记#小编为大家整理,主要介绍了markdown[软件代理设置]相关的知识,希望对你有一定的参考价值。 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • 生成对抗式网络GAN及其衍生CGAN、DCGAN、WGAN、LSGAN、BEGAN介绍
    一、GAN原理介绍学习GAN的第一篇论文当然由是IanGoodfellow于2014年发表的GenerativeAdversarialNetworks(论文下载链接arxiv:[h ... [详细]
  • iOS Swift中如何实现自动登录?
    本文介绍了在iOS Swift中如何实现自动登录的方法,包括使用故事板、SWRevealViewController等技术,以及解决用户注销后重新登录自动跳转到主页的问题。 ... [详细]
  • SpringBoot整合SpringSecurity+JWT实现单点登录
    SpringBoot整合SpringSecurity+JWT实现单点登录,Go语言社区,Golang程序员人脉社 ... [详细]
  • 本文详细介绍了在Centos7上部署安装zabbix5.0的步骤和注意事项,包括准备工作、获取所需的yum源、关闭防火墙和SELINUX等。提供了一步一步的操作指南,帮助读者顺利完成安装过程。 ... [详细]
  • GSIOpenSSH PAM_USER 安全绕过漏洞
    漏洞名称:GSI-OpenSSHPAM_USER安全绕过漏洞CNNVD编号:CNNVD-201304-097发布时间:2013-04-09 ... [详细]
  • Python脚本编写创建输出数据库并添加模型和场数据的方法
    本文介绍了使用Python脚本编写创建输出数据库并添加模型数据和场数据的方法。首先导入相应模块,然后创建输出数据库并添加材料属性、截面、部件实例、分析步和帧、节点和单元等对象。接着向输出数据库中添加场数据和历程数据,本例中只添加了节点位移。最后保存数据库文件并关闭文件。文章还提供了部分代码和Abaqus操作步骤。另外,作者还建立了关于Abaqus的学习交流群,欢迎加入并提问。 ... [详细]
  • 大坑|左上角_pycharm连接服务器同步写代码(图文详细过程)
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了pycharm连接服务器同步写代码(图文详细过程)相关的知识,希望对你有一定的参考价值。pycharm连接服务 ... [详细]
  • 概述H.323是由ITU制定的通信控制协议,用于在分组交换网中提供多媒体业务。呼叫控制是其中的重要组成部分,它可用来建立点到点的媒体会话和多点间媒体会议 ... [详细]
  • 现在比较流行使用静态网站生成器来搭建网站,博客产品着陆页微信转发页面等。但每次都需要对服务器进行配置,也是一个重复但繁琐的工作。使用DockerWeb,只需5分钟就能搭建一个基于D ... [详细]
author-avatar
保定联通员工
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有