2024年4月11日发(作者:)
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-list
add-src-to-address-list - 把一个源IP地址加入address-list
2 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 connection
0的意思是无限的,例如 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 option
Time - 时间
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 options
loose-source-routing - match packets with loose source routing option. This option is used toroute the internet
datagram based on information supplied by the source
no-record-route - match packets with no record route option. This option is used to route the
internet datagram based on information supplied by the source
no-router-alert - match packets with no router alter option
no-source-routing - match packets with no source routing option
no-timestamp - match packets with no timestamp option
record-route - match packets with record route option
router-alert - match packets with router alter option
strict-source-routing - match packets with strict source routing option
timestamp - match packets with timestamp
jump-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 bytes
发布者:admin,转转请注明出处:http://www.yc00.com/web/1712847091a2133674.html
评论列表(0条)