Hi All,
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,
# 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
Simple Queue code
# 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
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.
Adding and modify the code are welcome.
Thanks,
Ruhanda