ROS限速防synip伪装mac绑定防火墙各种命令使用详解屏蔽端口文档格式.docx
《ROS限速防synip伪装mac绑定防火墙各种命令使用详解屏蔽端口文档格式.docx》由会员分享,可在线阅读,更多相关《ROS限速防synip伪装mac绑定防火墙各种命令使用详解屏蔽端口文档格式.docx(19页珍藏版)》请在冰点文库上搜索。
一般的网络游戏,如梦幻西游传奇封神榜等等,其下行在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/512000burst-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
RO映射
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代表定值不可修改
RO的IP:
mac绑定
绑定:
foreachiin=[/iparpfinddynamic=yes]do=[/iparpaddcopy-from=$i]
解除绑定:
foreachiin=[/iparpfind]do=[/iparpremove$i]
完了在interfaces里面选择内网在选择reply-only
RO设置的备份(两总方法)
files-filelist
backup即可(可以到你的ftp里面找)
背份资料命令行:
system回车
backup回车
savename=设置文件名回车
资料恢复命令
loadname=文件名回车
RO禁ping
/ipfirewallruleinputaddprotocol=icmpaction=dropcomment="
Dropexcesspings"
disabled=no
解ping
ip-firewall-filterrules
input:
将其屏蔽或者删掉
关于mac地址扫描
/toolmac-scanall
VPN与ppp建立用户
在interfaces--settings-pptpserver
Enabled选择mtu1500mru:
1500
keepaliveTimeout:
disabled
defaultProfiles:
default
Authentication:
下面打上四个对号(这也代表服务器启动)
ip-pool-ippool
pptp=192.168.0.150-192.168.0.160(此IP段为内网中没有在用的段)
pptp1=192.168.0.170-192.168.0.180(此IP段为内网中没有在用的段)
自己总结出来的,有人问,为什么要写2个ip段一个不也行吗。
。
这也是我自己的心得,我想看到这个资料的人也不是一般人。
呵呵
因为在vpn连接的时候我们要给他分配一个远程的主机ip做为网关。
在本配一个本地的做为ip。
所以选择了2个,往下看在
ppp-Secrets
newpppsecret
service:
pptp
routes:
可以添加网关(一般VPN都是默认录找网关可添可不添)
Profiles:
LocalAddress:
在这里我添加的是pptp
RemoteAddress:
在这里我添加的是pptp1
dns,建议最好填写:
下面有两个useEncryptionRequireEncryption代表加密
Limits:
TxbitRate)用来限速的最大值
RxbitRate)用来限速的最小值
这也就表明了,远程给他一个地址,本地给他一个地址,这样可以更好的来识别。
最重要的,就是,基本每次都能拨上来。
可能有很多人说我能拨你家电信,为啥不
能拨网通,我来告诉你答案因为isp的关系。
在这里我就不详细说明了。
拨好的时候我就不说了,如果有问题在来问我。
检查磁盘
在路由或终端模拟下用下面命令:
system
check-disk
检查磁盘,要重启。
但是很慢,一分钟一G。
哈哈
关机
可以在WINBOX中关机,也可以用命令关:
sh
即可。
自我感觉不好使
如果有一些网页打不开,你ISP的MTU=1492,请在IP>
Firewall>
Mangle>
单击红加号>
Protocol选择TCP>
TcpOptions选择sync>
Actions选择accept>
TCPMSS:
1448。
ip-firewall-filterfules,选择+号,ininterface选择内网网卡(local),其他默认
这条路由允许来自内网的连接,如果有限制,可以修改srcaddress的ip段,或者content内容过滤
ip-》firewall-》filterchains选中input,选择drop
这条规则禁止所有的外部连接
以上两条规则,屏蔽来自外网的所有连接
一些恶意网站和广告,也可以从这里屏蔽
关于解决不能上XX的问题
把TCPMSS1448改成1432
记录网卡MAC地址才能限制网卡上网。
具体设置如下。
在防火墙里面的filterrules项选择forward然后添加一项设定也就是“+”号,
在advanced项里面的src.mac.address项里面加入网卡的MAC地址,然后在ACTION中选择Drop项。
这样子添加后,那块网卡的ip地址无论咋换,都
无法上网。
除非它把网卡换了。
我就是这样子作出来得,效果不错。
如果改了端口用winbox打不开了的解决方法
用SSH进入
/ipser
/ipser/>
setwwwport80
setftpport21
解决因防火墙屏蔽来自内网的所有连接
进入后输入/ipfruo可打开OUTPUT输入//ipfruin可打开INPUT
再、输入p可看结果
按REMO(此0为数字)可删除相应0的规则
你输入/ipfsetipa可恢复系统默认input改回accept。
或者,使用system里面的reset复位路由(会删除所有规则)
[admin@MikroTik]>
systemreset(系统自动复位清除设置并重新启动)
启用dns缓存
CODE
[admin@MikroTik]ipdns>
setallow-remote-requests=yes
..
user管理员只能在内网登陆
set0address=192.168.0.0/24
将规则另存为*.rsc文件,进入控制台,或者在路由器本机上,输入import*.rsc
该规则导入完成
基本也就这些了,还有自己知道的,也说不出来的,在有写东西是我自己在网络中找的。
本人都已经测试过了。
斩断扫描ros的黑手
以下是引用片段:
/ipfirewallfilteraddchain=inputprotocol=tcppsd=21,3s,3,1action=add-src-to-address-listaddress-list="
portscanners"
address-list-timeout=14dcomment="
Portscannerstolist"
disabled=no
/ipfirewallfilteraddchain=inputprotocol=tcptcp-flags=fin,!
syn,!
rst,!
psh,!
ack,!
urgaction=add-src-to-address-listaddress-list="
NMAPFINStealthscan"
/ipfirewallfilteraddchain=inputprotocol=tcptcp-flags=fin,synaction=add-src-to-address-listaddress-list="
SYN/FINscan"
/ipfirewallfilteraddchain=inputprotocol=tcptcp-flags=syn,rstaction=add-src-to-address-listaddress-list="
SYN/RSTscan"
/ipfirewallfilteraddchain=inputprotocol=tcptcp-flags=fin,psh,urg,!
ackaction=add-src-to-address-listaddress-list="
FIN/PSH/URGscan"
/ipfirewallfilteraddchain=inputprotocol=tcptcp-flags=fin,syn,rst,psh,ack,urgaction=add-src-to-address-listaddress-list="
ALL/ALLscan"
/ipfirewallfilteraddchain=inputprotocol=tcptcp-flags=!
fin,!
NMAPNULLscan"
/ipfirewallfilteraddchain=inputsrc-address-list="
action=dropcomment="
droppingportscanners"
RouterOS终极提速,彻底解决ros小包(网络游戏数据包)转发性能差的问题
以下只给有ros基础的人看,2.9.7以上版本支持,2.9.26上调试通过
ros终端界面直接输入即可
HTBQOS流量质量控制
/ipfirewallmangle
addchain=forwardp2p=all-p2paction=mark-connectionnew-connection-mark=p2p_connpassthrough=yescomment="
"
addchain=forwardconnection-mark=p2p_connaction=mark-packetnew-packet-mark=p2ppassthrough=yescomment="
addchain=forwardconnection-mark=!
p2p_connaction=mark-packetnew-packet-mark=generalpassthrough=yescomment="
addchain=forwardpacket-size=32-512action=mark-packetnew-packet-mark=smallpassthrough=yescomment="
addchain=forwardpacket-size=512-1200action=mark-packetnew-packet-mark=bigpassthrough=yescomment="
/queuetree
addname="
p2p1"
parent=TELpacket-mark=p2plimit-at=2000000queue=defaultpriority=8max-limit=6000000burst-limit=0burst-threshold=0burst-time=0sdisabled=no
p2p2"
parent=LANpacket-mark=p2plimit-at=2000000queue=defaultpriority=8max-limit=6000000burst-limit=0burst-threshold=0burst-time=0sdisabled=no
ClassA"
parent=LANpacket-mark="
limit-at=0queue=defaultpriority=8max-limit=100000000burst-limit=0burst-threshold=0burst-time=0sdisabled=no
ClassB"
parent=ClassApacket-mark="
limit-at=0queue=defaultpriority=8max-limit=0burst-limit=0burst-threshold=0burst-time=0sdisabled=no
Leaf1"
parent=ClassApacket-mark=generallimit-at=0queue=defaultpriority=7max-limit=0burst-limit=0burst-threshold=0burst-time=0sdisabled=no
Leaf2"
parent=ClassBpacket-mark=smalllimit-at=0queue=defaultpriority=5max-limit=0burst-limit=0burst-threshold=0burst-time=0sdisabled=no
Leaf3"
parent=ClassBpacket-mark=biglimit-at=0queue=defaultpriority=6max-limit=0burst-limit=0burst-threshold=0burst-time=0sdisabled=no
1-8级优先级控制,数字越小优先级越高
LAN内网接口
TEL外网接口
SMALL小包32-512字节5级优先级
BIG大包512-1200字节6级优先级
general其它包1200-1500字节7级优先级
P2P类8级优先,全局限速600KB/S下载
Leaf子类
我这边网吧用的是电信光纤,没有网同,所以机器只装了2个网卡.我是用光盘安装的.
首先看看网卡是否都被识别出来了,命令是:
/interface
print
可以缩写为
/int
pri
然后我们来激活他们,命令是:
ENABLE0
ENABLE1
0是第一块网卡。
激活后没有提示。
用print命令查看后发现网卡前面的X变成R,就代表激活成功了。
所以我把网卡给改个名字:
命令:
set0name=dianxin
set1name=neiwang
然后给他们相应的IP。
先返回顶层目录,用/键就可以了。
然后输入:
IP
ADDRESS
addaddress192.168.0.1/24interfaceneiwang
addaddressxxx.xxx.xxx.xxx/24interfacewaiwang(这里写ISP给的地址)
这样就设置好了dianxin、neiwang网卡的IP和子网掩码。
24代表255.255.255.0
添加完后可以用print命令来查看结果。
如果发现某条有错误,用“remove错误的编号“既可以删除。
我比较喜欢在命令行下面操作,我们来设置外网的网关
setup
会出来选项,这里的选项就是安装的时候你所选择的组件,