Agree with you Normunds. Users are confusing multiple mirror sites with P2P. Yet, for all those who use FileTopia... Have you seen the extensive P2P-like downloads on HTTPS? Several times realized the download goes straight between the clients. That is definitely P2P! And on HTTPS! What now, limit HTTPs? LOLrapidshare is not p2p, it's just a regular file hosting site.
:foreach i in=[/ip dns cache find] do={
:if ([:find [/ip dns cache get $i name] "rapidshare"] > 0) do={
:log info ("rapidshare: " . [/ip dns cache get $i name] . " (ip address " . [/ip dns cache get $i address] . ")")
/ip firewall address-list add address=[/ip dns cache get $i address] list=rapidshare disabled=no
}
}
/ip firewall address-list remove [/ip firewall address-list find list=rapidshare]
:foreach i in=[/ip dns cache find] do={
:if ([:find [/ip dns cache get $i name] "rapidshare"] > 0) do={
:log info ("rapidshare: " . [/ip dns cache get $i name] . " (ip address " . [/ip dns cache get $i address] . ")")
(......add ip rule checking in addresslist here: w/ foreach and if)
/ip firewall address-list add address=[/ip dns cache get $i address] list=rapidshare disabled=no
(......end of add ip rule checking in addressllist here: w/ foreach and if)
}
}
:foreach f in=[/ip firewall address-list find] do={
:if ([/ip firewall address-list get $f address ] != [/ip dns cache get $i address] ) do={
...
# check every dns entry
:foreach i in=[/ip dns cache find] do={
:local bNew "true";
# check if dns name contains rapidshare
:if ([:find [/ip dns cache get $i name] "rapidshare"] != 0) do={
:local tmpAddress [/ip dns cache get $i address] ;
#---- if address list is empty do not check ( add address directly )
:if ( [/ip firewall address-list find ] = "") do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no;
} else={
#------- check every address list entry
:foreach j in=[/ip firewall address-list find ] do={
#---------- set bNew variable to false if address exists in address list
:if ( [/ip firewall address-list get $j address] = $tmpAddress ) do={
:set bNew "false";
}
}
#------- if address is new then add to address list
:if ( $bNew = "true" ) do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no
}
}
}
}
# [ THE END ]
!= 0
>= 0
It's not possible ( TESTED, WORKING ). Make sure you typed code correctly.Still doesn´t work like it is supposed. It writes every ip saved in cache in DNS.
Yes it is possible. Calculate subnets address range and check if IP is in that range. It's quite easy, but you will have to do it for yourself. If you want to use scripts then learn how to script.But there is still some problem: if there is subnet´s ip in address list(237.138.168.0/24) it is also writes the ip´s that belong that subnet(207.138.168.61). Could it be possible to edit it not to write ips of subnet if the subnet is allready in address list?
Calculate subnets address range and check if IP is in that range. It's quite easy, but you will have to do it for yourself. If you want to use scripts then learn how to script.
Hi all, long time since my last post, but here is something that is interesting - using BURSTS. While I had users in MT's internal "base" I used profiles with bursts, everyting worked just fine. Ppl had great speeds for surf and something less for long (large) downloads. And then I switched to a Radius server and sql database and couldn't make bursts to work ......what do you mean by 24h a day for rapidshare? rapidshare hosts files one by one, you can't download all day from it.
maybe you simply need some burst limitations (user can download fast for some time, then slows down), or use webproxy and block rapidshare entirely?
mrz please!!!!Yes it is possible. Calculate subnets address range and check if IP is in that range. It's quite easy, but you will have to do it for yourself. If you want to use scripts then learn how to script.
C:\>nslookup
*** Can't find server name for address 192.168.0.2: Non-existent domain
*** Default servers are not available
Default Server: UnKnown
Address: 192.168.0.2
> rapidshare.com
Server: UnKnown
Address: 192.168.0.2
Non-authoritative answer:
Name: rapidshare.com
Addresses: 195.122.131.14, 195.122.131.15, 195.122.131.250, 195.122.131.2
195.122.131.3, 195.122.131.4, 195.122.131.5, 195.122.131.6, 195.122.13
1.7
195.122.131.8, 195.122.131.9, 195.122.131.10, 195.122.131.11, 195.122.
131.12
195.122.131.13
>
0 ;;; Upload_ALL
chain=prerouting src-address-list=twi dst-address-list=!twi
action=mark-connection new-connection-mark=UPLOAD passthrough=yes
1 chain=prerouting connection-mark=UPLOAD src-address-list=""
dst-address-list=!twi action=change-tos new-tos=normal
2 chain=prerouting connection-mark=UPLOAD src-address-list=twi
dst-address-list=!twi action=mark-packet new-packet-mark=UPLOAD_P
passthrough=yes
3 ;;; Down_ALL
chain=postrouting dst-address-list=twi action=mark-connection
new-connection-mark=DOWNLOAD passthrough=yes
4 chain=postrouting connection-mark=DOWNLOAD action=change-tos
new-tos=normal
5 chain=postrouting connection-mark=DOWNLOAD action=mark-packet
new-packet-mark=DOWNLOAD_P passthrough=yes
6 ;;; DNS
chain=prerouting protocol=udp dst-port=53 src-address-list=twi
dst-address-list=!twi action=mark-connection new-connection-mark=DNS_UP
passthrough=yes
7 chain=prerouting protocol=udp dst-port=53 connection-mark=DNS_UP
src-address-list=twi dst-address-list=!twi action=change-tos
new-tos=min-delay
8 chain=prerouting protocol=udp dst-port=53 connection-mark=DNS_UP
src-address-list=twi dst-address-list=!twi action=mark-packet
new-packet-mark=DNS_UP passthrough=no
9 chain=postrouting protocol=udp src-port=53 dst-address-list=twi
action=mark-connection new-connection-mark=DNS_DOWN passthrough=yes
10 chain=postrouting protocol=udp src-port=53 connection-mark=DNS_DOWN
dst-address-list=twi action=change-tos new-tos=min-delay
11 chain=postrouting protocol=udp src-port=53 connection-mark=DNS_DOWN dst-address-list=twi action=mark-packet
new-packet-mark=DNS_DOWN_P passthrough=no
12 ;;; HTTP_UP
chain=prerouting protocol=tcp dst-port=80 src-address-list=twi dst-address-list=!twi action=mark-connection
new-connection-mark=HTTP_UP passthrough=yes
13 chain=prerouting protocol=tcp dst-port=80 connection-mark=HTTP_UP src-address-list=twi dst-address-list=!twi
action=change-tos new-tos=max-throughput
14 ;;; first_512kB_UP
chain=prerouting protocol=tcp dst-port=80 connection-mark=HTTP_UP connection-bytes=0-512000 src-address-list=twi
dst-address-list=!twi action=mark-packet new-packet-mark=PRVIH_512_UP passthrough=no
15 ;;; rest_UP
chain=prerouting protocol=tcp dst-port=80 connection-mark=HTTP_UP src-address-list=twi dst-address-list=!twi
action=mark-packet new-packet-mark=HTTP_UP_P passthrough=no
16 ;;; HTTP_DOWN
chain=postrouting protocol=tcp src-port=80 src-address-list=!twi dst-address-list=twi action=mark-connection
new-connection-mark=HTTP_DOWN passthrough=yes
17 chain=postrouting protocol=tcp src-port=80 connection-mark=HTTP_DOWN dst-address-list=twi action=change-tos
new-tos=max-throughput
18 ;;; First_MB_Down
chain=postrouting protocol=tcp src-port=80 connection-mark=HTTP_DOWN connection-bytes=0-1024000
src-address-list=!twi dst-address-list=twi action=mark-packet new-packet-mark=HTTP_DOWN_1MB passthrough=no
19 ;;; rest
chain=postrouting protocol=tcp src-port=80 connection-mark=HTTP_DOWN src-address-list=!twi dst-address-list=twi
action=mark-packet new-packet-mark=HTTP_DOWN_P passthrough=no
mrz's script is working perfect. But what's the correct code to be added to the script to calculate sunet as above?Yes it is possible. Calculate subnets address range and check if IP is in that range. It's quite easy, but you will have to do it for yourself. If you want to use scripts then learn how to script.
# check every dns entry
:foreach i in=[/ip dns cache find] do={
:local bNew "true";
# check if dns name contains rapidshare
:if ([:find [/ip dns cache get $i name] "rapidshare"] != 0) do={
:local tmpAddress [/ip dns cache get $i address] ;
:for k from=0 to=255 do={
:put ("IP: ".$i address.".".$i address.".".$i address".".$k."");
#---- if address list is empty do not check ( add address directly )
:if ( [/ip firewall address-list find ] = "") do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no;
} else={
#------- check every address list entry
:foreach j in=[/ip firewall address-list find ] do={
#---------- set bNew variable to false if address exists in address list
:if ( [/ip firewall address-list get $j address] = $tmpAddress ) do={
:set bNew "false";
}
}
#------- if address is new then add to address list
:if ( $bNew = "true" ) do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no
}
}
}
}
}
# [ THE END ]
# check every dns entry
:foreach i in=[/ip dns cache find] do={
:local bNew "true";
# check if dns name contains rapidshare
:if ([:find [/ip dns cache get $i name] "rapidshare"] != 0) do={
:local tmpAddress [/ip dns cache get $i address] ;
#---- if address list is empty do not check ( add address directly )
:if ( [/ip firewall address-list find ] = "") do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no;
} else={
#------- check every address list entry
:foreach j in=[/ip firewall address-list find ] do={
#---------- set bNew variable to false if address exists in address list
:if ( [/ip firewall address-list get $j address] = $tmpAddress ) do={
:set bNew "false";
}
}
#------- if address is new then add to address list
:if ( $bNew = "true" ) do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no
}
}
}
}
# [ THE END ]
This script was written initially on version 3.0rc. It was working fine on all 3.x versions since. I haven't tested it on 2.9. Probably it isn't working on 2.9 because you have to use nil or something else to compare:mrz's script doesnt work at my MT..
like radocicala wrote .. It writes every ip saved in cache in DNS !
same at my MT!
I copied and pasted the code. So no type error possible!
i have version 2.9.49 .. maybe thats the reason why it doesnt work?!?
:if ([:find $cacheName "ss.lv"] != nil ) do={ .....
# check every dns entry
:foreach i in=[/ip dns cache find] do={
:local bNew "true";
# check if dns name contains rapidshare
:if ([:find [/ip dns cache get $i name] "rapidshare"] != 0) do={
:local tmpAddress [/ip dns cache get $i address] ;
# convert IP to "/24" type address
:local mjesto ([:find $tmpAddress "."]);
:set mjesto ([:find $tmpAddress "." $mjesto]);
:set mjesto ([:find $tmpAddress "." $mjesto]);
:local tmpAddress ([:pick $tmpAddress 0 $mjesto]);
:set tmpAddress ($tmpAddress . ".0/24");
#---- if address list is empty do not check ( add address directly )
:if ( [/ip firewall address-list find ] = "") do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no;
} else={
#------- check every address list entry
:foreach j in=[/ip firewall address-list find ] do={
#---------- set bNew variable to false if address exists in address list
:if ( [/ip firewall address-list get $j address] = $tmpAddress ) do={
:set bNew "false";
}
}
#------- if address is new then add to address list
:if ( $bNew = "true" ) do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no
}
}
}
}
# convert IP to "/24" type address
:local mjesto ([:find $tmpAddress "."]);
:set mjesto ([:find $tmpAddress "." $mjesto]);
:set mjesto ([:find $tmpAddress "." $mjesto]);
:local tmpAddress ([:pick $tmpAddress 0 $mjesto]);
:set tmpAddress ($tmpAddress . ".0/24");
there is a bug in 3.4 scripting, it will be fixed in 3.5 which should be out sometime this weekmrz
The script works with v3.2 fine.
The problem is back again with v3.4. It writes all the addresses from cache in v3.4.
Buy more bandwidth!!! it's easy to say where 1mbps cost 30-40 dollars or something like that... in my country (w)isp pay more than u$s500 for 1mbps.@normis
Cpresto is aware of that, but many clients use rapidshare, and downloadind all day long. So it is like p2p bandwith is 100% used.
@cpresto
Cmon man, what do you want? buy more bandwith.
Do you expect from your customers to read&send mail. Yeah right.
how often do you execute this script? (schedule)I tried this script to find rapidshare and other servers in cache, but problem is that script works well just under the routeros v3.
Could you edit it to work well under v2.9?
# check every dns entry
:foreach i in=[/ip dns cache find] do={
:local bNew "true";
# check if dns name contains rapidshare
:if ([:find [/ip dns cache get $i name] "rapidshare"] != 0) do={
:local tmpAddress [/ip dns cache get $i address] ;
#---- if address list is empty do not check ( add address directly )
:if ( [/ip firewall address-list find ] = "") do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no;
} else={
#------- check every address list entry
:foreach j in=[/ip firewall address-list find ] do={
#---------- set bNew variable to false if address exists in address list
:if ( [/ip firewall address-list get $j address] = $tmpAddress ) do={
:set bNew "false";
}
}
#------- if address is new then add to address list
:if ( $bNew = "true" ) do={
/ip firewall address-list add address=$tmpAddress list=rapidshare disabled=no
}
}
}
}
}
# [ THE END ]
Sounds like you maybe aren't charging enough if your bandwidth costs that much..1mbps cost from u$s500 to u$s2000 in my country. Our clients pay for a 512kbps access u$s20...
i know that...Sounds like you maybe aren't charging enough if your bandwidth costs that much..1mbps cost from u$s500 to u$s2000 in my country. Our clients pay for a 512kbps access u$s20...
# sep/01/2010 17:19:23 by RouterOS 4.9
/ip firewall layer7-protocol
add comment="" name=EXE regexp="^.*get.+\\.exe.*\$"
add comment="" name=RAR regexp="^.*get.+\\.rar.*\$"
add comment="" name=ZIP regexp="^.*get.+\\.zip.*\$"
add comment="" name=7z regexp="^.*get.+\\.7z.*\$"
add comment="" name=FLV regexp="^.*get.+\\.flv.*\$"
add comment="" name=WMV regexp="^.*get.+\\.wmv.*\$"
add comment="" name=MP3 regexp="^.*get.+\\.mp3.*\$"
add comment="" name=MP4 regexp="^.*get.+\\.mp4.*\$"
add comment="" name=3GP regexp="^.*get.+\\.3gp.*\$"
/ip firewall address-list
add address=192.168.1.0/24 comment="" disabled=no list=Local_Networks
add address=192.168.2.0/24 comment="" disabled=no list=Local_Networks
add address=10.5.50.0/24 comment="" disabled=no list=Local_Networks
add address=10.5.51.0/24 comment="" disabled=no list=Local_Networks
/ip firewall filter
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download EXE" disabled=no \
layer7-protocol=EXE protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download 7z" disabled=no \
layer7-protocol=7z protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download ISO" content=.iso \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download ZIP" disabled=no \
layer7-protocol=ZIP protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download MPEG" content=\
.mpeg disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download MPG" content=.mpg \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download FLV" disabled=no \
layer7-protocol=FLV protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download 3GP" disabled=no \
layer7-protocol=3GP protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download RM" content=.rm \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download AVI" content=.avi \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download RAR" disabled=no \
layer7-protocol=RAR protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download MP4" disabled=no \
layer7-protocol=MP4 protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download MKV" content=.mkv \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download MOV" content=.mov \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download MSI" content=.msi \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download WAV" content=.wav \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download WMV" disabled=no \
layer7-protocol=WMV protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download WMA" content=.wma \
disabled=no protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download MP3" disabled=no \
layer7-protocol=MP3 protocol=tcp src-address-list=Local_Networks
add action=add-dst-to-address-list address-list=DOWNLOAD \
address-list-timeout=1h chain=forward comment="Download Videoplayback" \
content=videoplayback disabled=no protocol=tcp src-address-list=\
Local_Networks
/ip firewall mangle
add action=mark-connection chain=prerouting comment=DOWNLOAD disabled=no \
dst-address-list=DOWNLOAD dst-port=80,8080,3128 in-interface=LAN \
new-connection-mark=QoS_5_con_downld passthrough=yes protocol=tcp
add action=mark-packet chain=prerouting comment="" connection-mark=\
QoS_5_con_downld disabled=no new-packet-mark=QoS_5 passthrough=no
add action=mark-connection chain=prerouting comment="" disabled=no \
dst-address-list=DOWNLOAD dst-port=110,995,143,993,25,20,21 in-interface=\
LAN new-connection-mark=QoS_5_con_downld passthrough=yes protocol=tcp
add action=mark-packet chain=prerouting comment="" connection-mark=\
QoS_5_con_downld disabled=no new-packet-mark=QoS_5 passthrough=no
add action=mark-connection chain=prerouting comment=BROWSING disabled=no \
dst-port=80,8080,3128,443,7778 in-interface=LAN new-connection-mark=\
QoS_4_con packet-size=0-666 passthrough=yes protocol=tcp tcp-flags=syn
add action=mark-packet chain=prerouting comment="" connection-mark=QoS_4_con \
disabled=no new-packet-mark=QoS_4 passthrough=no
add action=mark-connection chain=prerouting comment="" connection-bytes=\
0-1000000 disabled=no dst-port=80,8080,3128,443,7778 in-interface=LAN \
new-connection-mark=QoS_4_con passthrough=yes protocol=tcp
add action=mark-packet chain=prerouting comment="" connection-mark=QoS_4_con \
disabled=no new-packet-mark=QoS_4 passthrough=no
add action=mark-connection chain=prerouting comment="" disabled=no dst-port=\
110,995,143,993,25,20,21 in-interface=LAN new-connection-mark=QoS_4_con \
packet-size=0-666 passthrough=yes protocol=tcp tcp-flags=syn
add action=mark-packet chain=prerouting comment="" connection-mark=QoS_4_con \
disabled=no new-packet-mark=QoS_4 passthrough=no
add action=mark-connection chain=prerouting comment="" connection-bytes=\
0-1000000 disabled=no dst-port=110,995,143,993,25,20,21 in-interface=LAN \
new-connection-mark=QoS_4_con passthrough=yes protocol=tcp
add action=mark-packet chain=prerouting comment="" connection-mark=QoS_4_con \
disabled=no new-packet-mark=QoS_4 passthrough=no
# sep/01/2010 17:19:54 by RouterOS 4.9
#
#
/queue type
set default-small kind=pfifo name=default-small pfifo-limit=10
/queue simple
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" \
direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=\
256k/2M max-limit=500k/3M name=TOTAL parent=none priority=5 queue=\
default-small/default-small target-addresses=\
192.168.2.0/24,10.5.50.0/24,10.5.51.0/24 total-queue=default-small
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" \
direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=\
32k/128k max-limit=256k/2M name=QoS_4-Browsing packet-marks=QoS_4 parent=\
TOTAL priority=4 queue=default-small/default-small target-addresses=\
192.168.2.0/24,10.5.50.0/24,10.5.51.0/24 total-queue=default-small
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s comment="" \
direction=both disabled=no dst-address=0.0.0.0/0 interface=all limit-at=\
16k/32k max-limit=128k/2M name=QoS_5-Download packet-marks=QoS_5 parent=\
TOTAL priority=5 queue=default-small/default-small target-addresses=\
192.168.2.0/24,10.5.50.0/24,10.5.51.0/24 total-queue=default-small