防火墙规则Word文件下载.docx
《防火墙规则Word文件下载.docx》由会员分享,可在线阅读,更多相关《防火墙规则Word文件下载.docx(9页珍藏版)》请在冰豆网上搜索。
ros防火墙名词解释
input-进入路由,并且需要对其处理
forward-路由转发
output-经过路由处理,并且从接口出去的包
action:
1accept:
接受
add-dst-to-address-list-把一个目标IP地址加入address-list
add-src-to-address-list-把一个源IP地址加入address-list
2drop-丢弃
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不是非常的确定和一个新的规则需要添加注释,
transferedthroughtheparticularconnection
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(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-每秒最大的包数量
byTimeoption
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-matchpacketwithatleastoneoftheipv4options
loose-source-routing-matchpacketswithloosesourceroutingoption.Thisoptionisusedtoroutetheinternetdatagrambasedoninformationsuppliedbythesource
no-record-route-matchpacketswithnorecordrouteoption.Thisoptionisusedtoroutethe
internetdatagrambasedoninformationsuppliedbythesource
no-router-alert-matchpacketswithnorouteralteroption
no-source-routing-matchpacketswithnosourceroutingoption
no-timestamp-matchpacketswithnotimestampoption
record-route-matchpacketswithrecordrouteoption
router-alert-matchpacketswithrouteralteroption
strict-source-routing-matchpacketswithstrictsourceroutingoption
timestamp-matchpacketswithtimestamp
jump-target(forward|input|output|name)-跳转
limit(integer|time|integer)-限制
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)-包大小
rangeinbytes
Min-最小
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)-matchespacketsrandomlywithgivenpropability
reject-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)-源端口
tcp-flags(ack|cwr|ece|fin|psh|rst|syn|urg)-TCP标志类型
ack-acknowledgingdata
cwr-congestionwindowreduced
ece-ECN-echoflag(explicitcongestionnotification)
fin-closeconnection
psh-pushfunction
rst-dropconnection
syn-newconnection
urg-urgentdata
tcp-mss(integer:
0..65535)-TCPMSS
time(time|time|sat|fri|thu|wed|tue|mon|sun)-allowstocreatefilterbasedonthepackets'
arrivaltimeanddateor,forlocallygeneratedpackets,departuretimeanddate
tos(max-reliability|max-throughput|min-cost|min-delay|normal)-specifiesamatchforthe
valueofTypeofService(ToS)fieldofanIPheader
max-reliability-maximizereliability(ToS=4)
max-throughput-maximizethroughput(ToS=8)
min-cost-minimizemonetarycost(ToS=2)
min-delay-minimizedelay(ToS=16)
normal-normalservice(ToS=0)
:
foreachiin=[/systemloggingfacilityfindlocal=memory]do=[/systemloggingfacilityset$ilocal=none]
RO防syn
ip-firewall-connections
Tracking:
TCPSynSentTimeout:
50
TCPsynreceivedtimeout:
30
限线程脚本:
foraaafrom2to254do={/ipfirewallfilteraddchain=forwardsrc-address=(192.168.0..$aaa)protocol=tcpconnection-limit=50,32action=drop}
RO端口的屏蔽
ip-firewall-FilerRules里面选择
forward的意思代表包的转发
firewallrule-General
Dst.Address:
要屏蔽的端口
Protocol:
tcp
Action:
drop(丢弃)
ros限速
手动限速
winbox---queues----simplequeues
点“+”,NAME里随便填,下面是IP地址的确定
①TargetAddress不管,Dst.Address里填你要限制的内网机器的IP,比如我这里有个1号机器IP为192.168.1.101,那dst.address里就填192.168.1.101然后是/32(这里的32不是指掩码了,个人理解为指定的意思)!
②interface里记着要选你连接外网那个卡,我这里分了“local和public”,所以选public
③其他的不管,我们来看最重要的东西拉,Maxlimit,这个东西是你限制的上限,注意的是这里的数值是比特位,比如我要限制下载的速度为500K那么就填入多少呢?
500X1000X8=4000000=4M。
④另外,很多朋友都有个疑问,到底一般的用户会有多大流量呢?
一般的网络游戏,如梦幻西游传奇封神榜等等,其下行在20Kbps以内!
最耗网络资源的就是下载-----我们就是为了限制它拉,其次是VOD点播,一般DVD格式的大约要2M多吧,所以你看情况限制拉别搞的太绝!
!
限速脚本:
foraaafrom2to254do={/queuesimpleaddname=(queue.$aaa)dst-address=(192.168.0..$aaa)limit-at=0/0max-limit=2000000/2000000}说明:
aaa是变量
2to254是2~254
192.168.0..$aaa是IP
上两句加起来是192.168.0.2~192.168.0.254
connection-limit=50是线程数这里为50
max-limit=2000000/2000000是上行/下行
使用:
WinBox-System-Scripts-+
Name(脚本名程)
Source(脚本)
OK-选择要运行的脚本-RunScript
ROS限速的极致应用
一般我们用ros限速只是使用了max-limit,其实ros限速可以更好的运用。
比如我们希望客户打开网页时速度可以快一些,下载时速度可以慢一些。
ros2.9就可以实现。
max-limit------我们最常用的地方,最大速度
burst-limit--------突破速度的最大值
burst-thershold--------突破速度的阀值
burst-time-------突破速度的时间值
解释一下图片的限制意义
当客户机在30秒(burst-time)内的平均值小于突破速度阀值(burst-thershold)180K时,客户机的最大下载速率可以超过最大限速值(max-limit)200K,达到突破最大值(burst-limit)400K,如果30秒内平均值大于180K,那客户机的最大速度只能达到200K。
这样也就是当我们开网页时可以得到一个更大的速度400K,长时间下载时速度只能得到200K,使我们的带宽可以更有效的利用
动态限速
ROS动态限速(检测外网总速度进行限速开关)废话不说先看脚本原理:
以下操作全部在WINBOX界面里完成
介绍:
可以实现在总速度不超过9M的情况下自动关闭所有生成的限速规则在总速度超过18M的时候自动启动所有生成的限速规则。
说明:
在输入脚本内容时不要把两边的()带上,那个是为了区分非脚本字符。
总速度=你的外网网卡当前速度。
打开/system/scripts
脚本:
foraaafrom1to254do={/queuesimpleaddname=(ip_.$aaa)dst-address=(192.168.0..$aaa)interface=wanmax-limit=256000/800000burst-limit=1000000/3000000burst-threshold=128000/512000
burst-time=30s/1m}
上面是生成限速树,对网段内所有IP的限速列表!
下面进入正题:
脚本名:
node_on
脚本内容:
(:
foraaafrom1to254do={/queuesimen[findname=(ip_.$aaa)]})
node_off
foraaafrom1to254do={/queuesimdis[findname=(ip_.$aaa)]})
scripts(脚本部分)以完成
打开/tools/trafficmonitor
新建:
名:
node_18Mtraffic=receivedtrigger=aboveonevent=node_onthreshold:
18000000
node_9Mtraffic=receivedtrigger=belowonevent=node_offthreshold:
9000000
ROS映射
ip-firewall-DestinationNAT
General-In.Interfaceall(如果你是拨号的就选择pppoe的、固定IP选择all即可)
Dst.Address:
外网IP/32
Dst.Port:
要映射的端口
tcp(如果映射反恐的就用udp)
Actionaction:
nat
TODst.Addresses:
你的内网IP
TODst.Ports:
ip伪装
ip-firewall-SourceNAT
ActionAction:
masquerade(IP伪装)
回流(因为假如说在本网吧做SF需要回流)
在general-Src.address:
192.168.0.0/24这里特殊说明下内网ip段24代表定值不可修改ROS的IP:
mac绑定
绑定:
foreachiin=[/iparpfinddynamic=yes]do=[/iparpaddcopy-from=$i]
解除绑定:
foreachiin=[/iparpfind]do=[/iparpremove$i]
完了在interfaces里面选择内网在选择reply-only
ROS设置的备份(两种方法)
files-filelist
backup即可(可以到你的ftp里面找)背份资料命令行:
system回车backup回车
savename=设置文件名回车
资料恢复命令
system回车
backup回车
loadname=文件名回车