ROS软路由防火墙配置规则

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

ROS软路由防火墙配置规则Routeros防火墙功能非常灵活。routeros防火墙属于包过滤防火墙,你可以定义一系列的规则过滤掉发往routeros、从routeros发出、通过routeros转发的数据包。在routeros防火墙中定义了三个防火墙(过滤)链(即input、forward、output),你可以在这三个链当中定义你自己的规则。input意思是指发往routeros自己的数据(也就是目的ip是routeros接口中的一个ip地址);output意思是指从routeros发出去的数据(也就是数据包源ip是routeros接口中的一个ip地址);forward意思是指通过routeros转发的(比如你内部计算机访问外部网络,数据需要通过你的routeros进行转发出去)。禁止pingrouteros,我们一般需要在input链中添加规则,因为数据包是发给routeros的,数据包的目标ip是routeros的一个接口ip地址。(当然如果你硬是要在output里建立一条规则过滤掉icmp信息也能做到ping不通,当你ping的数据包到达routeos时,routeos能接收这个数据包并做出回应,当routeros回应给你的包要发出去的时候会检查output的规则并过滤掉回应你的包。)在每条链中的每条规则都有目标ip,源ip,进入的接口(ininterface),非常灵活的去建立规则。比如ROS禁止PING,禁止外网ping你routeros,只需要在ininterface中选择你连外部网络的接口。禁止内部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中默认都是允许所有的数据。也就是除非你在规则中明确禁止,否则允许。可以通过ipfirewallsetinputpolicy=drop等进行修改默认策略ros防火墙名词解释input-进入路由,并且需要对其处理forward-路由转发output-经过路由处理,并且从接口出去的包action:1accept:接受add-dst-to-address-list-把一个目标IP地址加入address-listadd-src-to-address-list-把一个源IP地址加入address-list2drop-丢弃3jump-跳转,可以跳转到一个规则主题里面,如inputforward,也可以跳转到某一条里面4log-日志记录5passthrough-忽略此条规则6reject-丢弃这个包,并且发送一个ICMP回应消息7return-把控制返回给jump的所在8tarpit-捕获和扣留进来的TCP连接(用SYN/ACK回应进来的TCPSYN包)address-list(name)-把从action=add-dst-to-address-listoraction=add-src-to-address-listactions得到的IP地址放入address-list列表.这个列表要用来对比address-list-timeout看是什么时候用address-listparameter从addresslist中移走chain(forward|input|output|name)-使用chain得到特定列表,不同的数据流经过不同的chain规则要仔细的选对正确的访问控制.如果input不是非常的确定和一个新的规则需要添加注释,transferedthroughtheparticularconnection0的意思是无限的,例如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(IPaddress|netmask|IPaddress|IPaddress)-目标地址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-每秒最大的包数量byTimeoptionTime-时间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-matchpacketwithatleastoneoftheipv4optionsloose-source-routing-matchpacketswithloosesourceroutingoption.Thisoptionisusedtoroutetheinternetdatagrambasedoninformationsuppliedbythesourceno-record-route-matchpacketswithnorecordrouteoption.Thisoptionisusedtoroutetheinternetdatagrambasedoninformationsuppliedbythesourceno-router-alert-matchpacketswithnorouteralteroptionno-source-routing-matchpacketswithnosourceroutingoptionno-timestamp-matchpacketswithnotimestampoptionrecord-route-matchpacketswithrecordrouteoptionrouter-alert-matchpacketswithrouteralteroptionstrict-source-routing-matchpacketswithstrictsourceroutingoptiontimestamp-matchpacketswithtimestampjump-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)-包大小rangeinbytesMin-最小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)-matchespacketsrandomlywithgivenpropabilityreject-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(IPaddress|netmask|IPaddress|IPaddress)-源地址src-address-list(name)-源地址列表src-address-type(unicast|local|broadcast|multicast)-源地址类型src-mac-address(MACaddress)-源MAC地址src-port(integer:0..65535|integer:0..65535)-源端口tcp-flags(ack|cwr|ece|fin|psh|rst|syn|urg)-TCP标志类型ack-acknowledgingdatacwr-congestionwindowreducedece-ECN-echoflag(explicitcongestionnotification)fin-closeconnectionpsh-pushfunctionrst-dropconnectionsyn-newconnectionurg-urgentdatatcp-mss(integer:0..65535)-TCPMSStime(time|time|sat|fri|thu|wed|tue|mon|sun)-allowstocreatefilterbasedonthepackets'arrivaltimeanddateor,forlocallygeneratedpackets,departuretimeanddatetos(max-reliability|max-throughput|min-cost|min-delay|normal)-specifiesamatchforthevalueofTypeofService(ToS)fieldofanIPheaderma

1 / 6
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功