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.
mrz's script is working perfect. But what's the correct code to be added to the script to calculate sunet as above?
Joined: Sun Jan 06, 2008 1:48 am Posts: 20
Karma: 0
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?!?
here ones more mrz's code ..
Code:
# 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 } } } }
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?!?
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:
Joined: Sun Dec 18, 2005 5:23 pm Posts: 77
Karma: 0
This script adds /24 type addresses to address-list in mrz's code. I'm newbie in scripting so maybe ther is more cleaner way to do that but...
Code:
# 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 } } } }
even more: address list allows you to write 207.138.168.61 even if 207.138.168.61 already exist =) and if you delete second 207.138.168.61, ROS will act as you deleted both of them, until you disable and then enable residual item. it's not a feature, i'ts a BUG, but i write to support when v3.3 was the latest, still not resloved.
Normis?..
_________________ For every complex problem, there is a solution that is simple, neat, and wrong.
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 } } } } }
Joined: Sun Jun 25, 2006 11:55 pm Posts: 231
Karma: 0
Location: Argentina
titius wrote:
@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.
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. 1mbps cost from u$s500 to u$s2000 in my country. Our clients pay for a 512kbps access u$s20... rapidshare, megaupload, gigasize, all-p2p, are really a headache to us.
Joined: Sun Jun 25, 2006 11:55 pm Posts: 231
Karma: 0
Location: Argentina
radocicala wrote:
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 } } } } }
Dude you are talking about bandwidth price! in our country we had to pay near 2000 $ US for 1 mb and from few days the cost is bearable now we have to pay 1000$ US per mb, so this is costly than them who pay nearly 50 to 80 $ US per mb. I'm sorry cause this is now going away from the main topic but can't help writing this.
Hi guys, well.. I own an ISP and i have to deal with this stuff also! My workaround was inside the queues. I just made good use of Limit-at and Max-limit. Set Max-Limit of your client as the maximum bandwidth he can use, and Limit-at you can set at 15% or 30% of the maximum bandwidth. The most important thing is that in hierarchy of queues, the top most important must not exceed your total bandwidth with the sum of Limit-At rules! I hope it works for you as it worked for me... Since users with Download Managers and Rapidshare accounts Premium get lots of bandwidth available, they normally consume all of your bandwidth, but with this rules, they will drop if other users need the bandwidth too! And make a GOOD CONFIGURED PROXY working, this will help A LOT!!! Cya around!!!
Write "rapidshare" in content field in the filter rule that you created for rapidshare. it works for me. it block also web pages which has rapidshare links in it.
I had an idea of a more accurate way to do this, by finding RapidShare's AS and then pushing all associated prefixes into an address list. This was a great theory, then I discovered they seem to be using their upstream providers ASN of 3356
Joined: Tue Aug 25, 2009 12:01 am Posts: 378
Karma: 1
Rapidshare isnt p2p. Rapidshare is simply downloading a file from the net. Lets say I have 100mb of pictures I want to email you. But emailing them would be dumb. I zip them, put them on rapidshare and send you the link to download it.
By blocking it, you could be blocking legit computer use and even business related use.
I dont know why people get so butt-hurt over p2p anyways. Just shape it down.
Joined: Sat Jul 05, 2008 11:50 am Posts: 184
Karma: 1
In my opinion this approach is incorrect. You need to run this script for a lot of content providers.
The best approach was indicated two times in this post: mangle with different packet marks http connection with less than 5MBytes and http connection with >= 5MBytes.
To the first give high priority (is browsing or download of small files); to the second give lower priority (you can use also pcq queue!).
This method will funcionction for all http downloads and needs no maintenance.
Joined: Mon Mar 09, 2009 12:00 am Posts: 446
Karma: 3
I tend to agree. However it's worth to note that connection size approach will "waste" 5GB of perfectly good bandwidth where ID by IP will "waste" none. Hence knowing that traffic is of certain kind immediatelly has it's value especially for slower links where 5GB download takes more than few seconds.
Not sure if this might help, we also quite a large WISP, we push heavy traffic, found that using a squid proxy server can save alot of data and u can manage certain sites
my problem was windowsupdates during the day as we have a 100mb internet breakout, so I slow it down to very small speed during the day and at night open it up
You can just add rapidshare there or make a new acl for it
Actually rapidshare is only web site that provide space so user can store and retrieve file by uploading or downloading files. the problem is downloading and uploading process using same port 80 with HTTP. In my internet cafe I'm using layer 7 protocol,firewall and queue to separate regular browsing and downloading files by set download priority lower then HTTP (Browsing). Sometimes filter using packet-size is not effective.
Due to user doing Download more intense than upload so the code is not separate it when upload. Please find the firewall code below,
For best result you can use PCQ and Queue Tree. but for me simple queue is enough for my internet cafe and all my customer satisfied with current internet cafe network speed.
Users browsing this forum: mhoppes, Yahoo [Bot] and 12 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum