Community discussions

MikroTik App
 
alaamokhtar
just joined
Topic Author
Posts: 14
Joined: Sun Jun 19, 2011 6:55 pm

limit speed for specific website

Sat Aug 04, 2012 5:23 pm

dear all
i have alot of users of facebook and you tube
i want to limit speed for these sites
how can i do this?
 
User avatar
hassibi
Trainer
Trainer
Posts: 130
Joined: Wed Jun 13, 2012 5:58 am
Location: Iran,Kerman

Re: limit speed for specific website

Sat Aug 04, 2012 9:43 pm

Hello
i think best way for limit your client in this sites is that you add address-list for ip address of this site or use "content" add add sites with content facebook or youtube and dynamicly add dst-address of this packets to an address list and then create a queue for this address-list my example:

/ip firewall filter add chain=forward content=facebook.com action=add-dst-to-address-list address-list=limitedsites address-list-timeout=5m
/ip firewall mangle add chain=forward dst-address-list=limitedsites action=mark-connection new-connection-mark=li-si-connection passthrough=yes
/ip firewall mangle add chain=forward connection-mark=li-si-connection action=mark-packet new-packet-mark=li-si-packets passthrough=no
/queue simple add packet-marks=li-si-packets max-limit=64k/64k

Good luck
 
DiabolixZA
newbie
Posts: 38
Joined: Wed Jul 06, 2011 5:06 pm

Re: limit speed for specific website

Thu Jul 17, 2014 1:42 pm

Hello
i think best way for limit your client in this sites is that you add address-list for ip address of this site or use "content" add add sites with content facebook or youtube and dynamicly add dst-address of this packets to an address list and then create a queue for this address-list my example:

/ip firewall filter add chain=forward content=facebook.com action=add-dst-to-address-list address-list=limitedsites address-list-timeout=5m
/ip firewall mangle add chain=forward dst-address-list=limitedsites action=mark-connection new-connection-mark=li-si-connection passthrough=yes
/ip firewall mangle add chain=forward connection-mark=li-si-connection action=mark-packet new-packet-mark=li-si-packets passthrough=no
/queue simple add packet-marks=li-si-packets max-limit=64k/64k

Good luck
Hi,

Weirdly looking for the exact same thing, will test out your solution tonight to see if it works!
 
DiabolixZA
newbie
Posts: 38
Joined: Wed Jul 06, 2011 5:06 pm

Re: limit speed for specific website

Thu Jul 17, 2014 9:24 pm

Hassibi, seems your solution doesn't work.

Not end of the world, I put something else together that works. For anyone who might be looking for something like this in the future :)

.../ip firewall layer7-protocol
add comment="" name=facebook regexp="facebook|fbcdn.net"

.../ip firewall mangle
add action=mark-packet chain=prerouting \
comment="Mark Packet Facebook" disabled=no \
layer7-protocol=facebook new-packet-mark=facebook \
passthrough=no

.../queue tree add name="Facebook" parent=global \
packet-mark=facebook limit-at=0 queue=default \
priority=8 max-limit=64k burst-limit=0 \
burst-threshold=0 burst-time=0s
 
User avatar
neodark
Frequent Visitor
Frequent Visitor
Posts: 62
Joined: Fri Dec 26, 2014 11:31 am
Location: Spain

Re: limit speed for specific website

Sat Jan 16, 2016 11:23 pm

Hassibi, seems your solution doesn't work.

Not end of the world, I put something else together that works. For anyone who might be looking for something like this in the future :)

.../ip firewall layer7-protocol
add comment="" name=facebook regexp="facebook|fbcdn.net"

.../ip firewall mangle
add action=mark-packet chain=prerouting \
comment="Mark Packet Facebook" disabled=no \
layer7-protocol=facebook new-packet-mark=facebook \
passthrough=no

.../queue tree add name="Facebook" parent=global \
packet-mark=facebook limit-at=0 queue=default \
priority=8 max-limit=64k burst-limit=0 \
burst-threshold=0 burst-time=0s
Hi, but this queue is total, right? I mean, this is max limit 64k for all users, not for each user... then the speed will be a lot slow... Any way to make it for all users (64k of this example) for each user (for facebook).

Regards!!
 
chshahzadnasir
newbie
Posts: 28
Joined: Sat Nov 05, 2016 8:26 pm
Location: Pakistan
Contact:

Re: limit speed for specific website

Sat Nov 26, 2016 4:20 am

Thanks for sharing this code. I try this for testing. Can I replace the value 64k/64k to 2Mb/10Mb in this script
 
chshahzadnasir
newbie
Posts: 28
Joined: Sat Nov 05, 2016 8:26 pm
Location: Pakistan
Contact:

Re: limit speed for specific website

Sat Nov 26, 2016 12:27 pm

hallo to alls please comment about this code Related Facebook Full speed bypass user profile
/ip firewall layer7-protocol
add comment=Browsing name=Browsing regexp=\
"\\.(xml)|\\.(php)|\\.(css)|\\.(js)\r\
\n^.*get.+\\.facebook.*\$"
add comment=photos name=photos regexp=\
"\\.(jpg)|\\.(gif)|\\.(ico)|\\.(jpeg)|\\.(png)|\\.(bmp)"

/ip firewall mangle
add action=mark-connection chain=prerouting comment=Browsing layer7-protocol=\
Browsing new-connection-mark=Browsing
add action=mark-packet chain=prerouting comment=Browsing connection-mark=\
Browsing new-packet-mark=Browsing passthrough=no
add action=mark-connection chain=prerouting comment=photos layer7-protocol=\
photos new-connection-mark=photos
add action=mark-packet chain=prerouting comment=photos layer7-protocol=photos \
new-packet-mark=photos

/queue tree
add comment=Browsing name=Browsing packet-mark=Browsing parent=global \
priority=1 queue=default
add comment=photos name=photos packet-mark=photos parent=global priority=1 \
queue=default
 
williankevenis
just joined
Posts: 4
Joined: Tue Oct 10, 2017 10:26 pm

Re: limit speed for specific website

Tue Oct 10, 2017 10:28 pm

Exactly, does anyone know how we can limit the speed for each user?
Hassibi, seems your solution doesn't work.

Not end of the world, I put something else together that works. For anyone who might be looking for something like this in the future :)

.../ip firewall layer7-protocol
add comment="" name=facebook regexp="facebook|fbcdn.net"

.../ip firewall mangle
add action=mark-packet chain=prerouting \
comment="Mark Packet Facebook" disabled=no \
layer7-protocol=facebook new-packet-mark=facebook \
passthrough=no

.../queue tree add name="Facebook" parent=global \
packet-mark=facebook limit-at=0 queue=default \
priority=8 max-limit=64k burst-limit=0 \
burst-threshold=0 burst-time=0s
Hi, but this queue is total, right? I mean, this is max limit 64k for all users, not for each user... then the speed will be a lot slow... Any way to make it for all users (64k of this example) for each user (for facebook).

Regards!!

Who is online

Users browsing this forum: No registered users and 19 guests