好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

防火墙规则.docx

8页
  • 卖家[上传人]:jiups****uk12
  • 文档编号:39995282
  • 上传时间:2018-05-22
  • 文档格式:DOCX
  • 文档大小:22.62KB
  • / 8 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • ROS 软路由防火墙规则(转自网络)routeros 防火墙功能非常灵活routeros 防火墙属于包过滤防火墙,你可以定义一系列的规则过滤掉发往 routeros、从 routeros 发出、通过 routeros 转发的数据包在 routeros 防火墙中定义了三个防火墙(过滤)链(即 input、forward、output),你可以在这三个链当中定义你自己的规则input 意思是指发往 routeros 自己的数据(也就是目的 ip 是 routeros 接口中的一个 ip 地址);output 意思是指从 routeros 发出去的数据(也就是数据包源 ip 是 routeros 接口中的一个 ip 地址);forward 意思是指通过 routeros 转发的(比如你内部计算机访问外部网络,数据需要通过你的 routeros进行转发出去)禁止 ping routeros,我们一般需要在 input 链中添加规则,因为数据包是发给 routeros 的,数据包的目标 ip 是 routeros 的一个接口 ip 地址当然如果你硬是要在 output 里建立一条规则过滤掉 icmp 信息也能做到 ping 不通,当你 ping 的数据包到达 routeos 时,routeos 能接收这个数据包并做出回应,当 routeros 回应给你的包要发出去的时候会检查 output 的规则并过滤掉回应你的包。

      在每条链中的每条规则都有目标 ip,源 ip,进入的接口(in interface),非常灵活的去建立规则比如ROS 禁止 PING,禁止外网 ping 你 routeros,只需要在 in interface 中选择你连外部网络的接口禁止内部ping 的话可以选择连你内部网络的接口如果禁止所有的 ping 的话,那么接口选择 all当然禁止 ping 协议要选择 icmp ,action 选择 drop 或 reject另外要注意的就是,icmp 协议并不是就指的是 ping,而是 ping 是使用 icmp 协议中的一种(我们ping 出去发送的数据包 icmp 协议的类型为 8 代码为 0,在 routeros 中写为 icmp-options=8:0;而我们对ping 做出回应 icmp 类型为 0 代码为 0),还有很多东西也属于 icmp 协议打个比方,如果你禁止内部网络 ping 所有外部网络,可以在 forward 链中建立一条规则,协议为 icmp,action 为 drop,其他默认,那么你内部网络 ping 不通外部任何地址,同时如果你用 trancroute 命令跟踪路由也跟踪不了。

      在做规则是要注意每一个细节还有就是,input,output,forward 三条链在 routeros 中默认都是允许所有的数据也就是除非你在规则中明确禁止,否则允许可以通过 ip firewall set input policy=drop 等进行修改默认策略ros 防火墙名词解释input - 进入路由,并且需要对其处理forward - 路由转发output - 经过路由处理,并且从接口出去的包action:1 accept: 接受add-dst-to-address-list - 把一个目标 IP 地址加入 address-listadd-src-to-address-list - 把一个源 IP 地址加入 address-list2 drop - 丢弃3 jump - 跳转,可以跳转到一个规则主题里面,如 input forward,也可以跳转到某一条里面4 log - 日志记录5 passthrough - 忽略此条规则6 reject - 丢弃这个包,并且发送一个 ICMP 回应消息7 return - 把控制返回给 jump 的所在8 tarpit - 捕获和扣留 进来的 TCP 连接 (用 SYN/ACK 回应进来的 TCP SYN 包)address-list (name) - 把从 action=add-dst-to-address-list or action=add-src-to-address-list actions 得到的 IP 地址放入 address-list 列表. 这个列表要用来对比 address-list-timeout 看是什么时候用 address-list parameter 从address list 中移走chain (forward | input | output | name) - 使用 chain 得到特定列表,不同的数据流经过不同的 chain 规则要仔细的选对正确的访问控制. 如果 input 不是非常的确定和一个新的规则需要添加注释,transfered through the particular connection0 的意思是无限的,例如 connection-bytes=2000000-0 意思是 2MB 以上connection-limit (integer | netmask) - 地址的传输流量控制connection-mark (name) - 传输中的标记后的数据包connection-state (estabilished | invalid | new | related) - 连接的状态(连接中,不规则的连接,新的连接,相互联系的连接)connection-type 连接的类型 (ftp | gre | h323 | irc | mms | pptp | quake3 | tftp)content 包的内容dst-address (IP address | netmask | IP address | IP address) - 目标地址dst-address-list (name) - 目标地址表dst-address-type (unicast | local | broadcast | multicast) - 目标地址类型unicast -点对点local - 本地地址broadcast - 广播multicast - 多播dst-limit (integer | time | integer | dst-address | dst-port | src-address | time) - 目标限制Count - 每秒最大的包数量by Time optionTime - 时间Burst - 突发的Mode -等级优先Expire - 终止dst-port 目标端口hotspot 暂时不做学习icmp-options (integer | integer) - ICMP 选择in-interface (name) - 进入接口ipv4-options (any | loose-source-routing | no-record-route | no-router-alert | no-source-routing |no-timestamp | none | record-route | router-alert | strict-source-routing | timestamp)any - match packet with at least one of the ipv4 optionsloose-source-routing - match packets with loose source routing option. This option is used toroute the internet datagram based on information supplied by the sourceno-record-route - match packets with no record route option. This option is used to route theinternet datagram based on information supplied by the sourceno-router-alert - match packets with no router alter optionno-source-routing - match packets with no source routing optionno-timestamp - match packets with no timestamp optionrecord-route - match packets with record route optionrouter-alert - match packets with router alter optionstrict-source-routing - match packets with strict source routing optiontimestamp - match packets with timestampjump-target (forward | input | output | name) -跳转limit (integer | time | integer) - 限制Count - 每秒最大的包数量Time - 突发的总时间log-prefix (text) - 如果还有定义的字符,加入日志out-interface (name) - 流出的接口p2p (all-p2p | bit-torrent | blubster | direct-connect | edonkey | fasttrack | gnutella | soulseek | warez| winmx) - P2P 协议packet-mark (text) - 给包标记packet-size (integer: 0..65535 | integer: 0..65535) - 包大小range in bytesMin - 最小Max - 最大phys-in-interface (name) - 物理上的进入接口phys-out-interface (name) -物理上的出去接口protocol (ddp | egp | encap | ggp | gre | hmp | icmp | idrp-cmtp | igmp | ipencap | ipip | ipsec-ah |ipsec-esp | iso-tp4 | ospf | pup | rdp | rspf | st | tcp | udp | vmtp | xns-idp | xtp | integer) -协议psd (integer | time | integer | integer) - 防止对 ROS 的端口扫描random (integer: 1..99) - matches packets randomly with given propabilityreject-with (icmp-admin-prohibited | icmp-echo-reply | icmp-host-prohibited |icmp-host-unreachable | icmp-net-prohibited | icmp-network-unreachable | icmp-port-unreachable |icmp-protocol-unreachable | tcp-reset | integer) - 改变 reject 的回答方式routing-mark (name) - 路由标记src-address (IP address | netmask | IP address | IP address) -源地址src-address-list (name) -源地址列表src-address-type (unicast | local | broadcast。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.