wrt54g Script Generator and dd-wrt help

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2
Author Message
Spaider
DD-WRT Novice


Joined: 29 Aug 2006
Posts: 17

PostPosted: Wed Aug 05, 2009 16:41    Post subject: Reply with quote
phuzi0n,
thanks, this put me one step further towards my goal. I always used "Download" section in Script Generator and did not even think that I should use "Upload" instead.

Now, at least something happens with my traffic. However, something strange. If nothing is using the connection and I download with one HTTP stream, for example, download rate significantly slower than I requested. For instance, if rate 230kbit and ceil 460kbit then it downloads no faster than 20 KB/s. I repeat, I use PPTP connection to ISP, could it be a reason for imq bizarre behaviour?

_________________
DD-WRT v.24 Mini on WRT54GL v.1.1
Sponsor
kmcheng
DD-WRT Novice


Joined: 22 May 2008
Posts: 22

PostPosted: Sun Aug 30, 2009 7:14    Post subject: Reply with quote
phuzi0n wrote:
Reviving this old thread from a link just to say that anyone looking to do mac based filtering with iptables be sure to load the kernel module for it.

insmod ipt_mac


tested on the now most current 12548M, won't work - I tested in different ways, I don't think mac address work.
I tested successfully on ip practically in one shot, the setting applies to both LAN and WAN (makes the access to router very slow). And yes, there is a about 25% margin of error. When you set the speed as 1000kb, you actually get around 800kb.
I wish I can get the bandwidth limit feature from the special edition here so that I don't need to play with commands.
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Sun Aug 30, 2009 9:50    Post subject: Reply with quote
MAC filtering does indeed still work, post your script.
_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
kmcheng
DD-WRT Novice


Joined: 22 May 2008
Posts: 22

PostPosted: Sun Aug 30, 2009 22:55    Post subject: Reply with quote
phuzi0n wrote:
MAC filtering does indeed still work, post your script.


tc qdisc del dev br0 root
tc qdisc add dev br0 root handle 1: htb
tc class add dev br0 parent 1: classid 1:1 htb rate 6500kbit
tc class add dev br0 parent 1:1 classid 1:10 htb rate 700kbit ceil 1000kbit prio 2
tc filter add dev br0 parent 1:0 protocol ip prio 2 u32 match u16 0x0800 0xFFFF at -2 match u32 0x00000000 0xFFFFFFFF at -12 match u16 0x0000 0xFFFF at -14 flowid 1:10
insmod imq
insmod ipt_mac
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 730kbit
tc class add dev imq0 parent 1:1 classid 1:10 htb rate 10kbit ceil 20kbit prio 2
iptables -t mangle -A PREROUTING -m mac --mac-source 00:00:00:00:00:00 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -j IMQ --todev 0

tested my own mac, doesn't work

by the way, can I set it to limit the connection on WAN only instead of LAN? I don't really care about LAN, the WAN is what's important.
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Mon Aug 31, 2009 1:43    Post subject: Reply with quote
You're missing insmod ipt_IMQ. The br0 code is for limiting downloads which won't work for mac filters without adding more code to save and restore connection marks. If you don't care about trying to limit downloads then you can remove it.
_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
kmcheng
DD-WRT Novice


Joined: 22 May 2008
Posts: 22

PostPosted: Mon Aug 31, 2009 2:44    Post subject: Reply with quote
phuzi0n wrote:
You're missing insmod ipt_IMQ. The br0 code is for limiting downloads which won't work for mac filters without adding more code to save and restore connection marks. If you don't care about trying to limit downloads then you can remove it.


so I need all these 3?
insmod imq
insmod ipt_mac
insmod ipt_IMQ

actually the most I concern about is download. So this pack of codes won't work for mac?
fggs
DD-WRT Guru


Joined: 28 Jan 2008
Posts: 1741

PostPosted: Mon Aug 31, 2009 3:03    Post subject: Reply with quote
I think there's no imq, just ipt_imq.
phuzi0n
DD-WRT Guru


Joined: 10 Oct 2006
Posts: 10141

PostPosted: Mon Aug 31, 2009 3:19    Post subject: Reply with quote
kmcheng wrote:
so I need all these 3?
insmod imq
insmod ipt_mac
insmod ipt_IMQ

actually the most I concern about is download. So this pack of codes won't work for mac?


Yes, look at the scripts that have been posted or regenerate one and you'll see both imq modules are needed. The imq module loads the imq device and the ipt_IMQ module loads the iptables target extension for it.

Adding this should get your downloads limited for the MAC rules.

iptables -t mangle -I PREROUTING -j CONNMARK --restore-mark
iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark

_________________
Read the forum announcements thoroughly! Be cautious if you're inexperienced.
Available for paid consulting. (Don't PM about complicated setups otherwise)
Looking for bricks and spare routers to expand my collection. (not interested in G spec models)
kmcheng
DD-WRT Novice


Joined: 22 May 2008
Posts: 22

PostPosted: Mon Aug 31, 2009 4:15    Post subject: Reply with quote
phuzi0n wrote:
kmcheng wrote:
so I need all these 3?
insmod imq
insmod ipt_mac
insmod ipt_IMQ

actually the most I concern about is download. So this pack of codes won't work for mac?


Yes, look at the scripts that have been posted or regenerate one and you'll see both imq modules are needed. The imq module loads the imq device and the ipt_IMQ module loads the iptables target extension for it.

Adding this should get your downloads limited for the MAC rules.

iptables -t mangle -I PREROUTING -j CONNMARK --restore-mark
iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark


so this is the complete code that should work?

tc qdisc del dev br0 root
tc qdisc add dev br0 root handle 1: htb
tc class add dev br0 parent 1: classid 1:1 htb rate 6500kbit
tc class add dev br0 parent 1:1 classid 1:10 htb rate 700kbit ceil 1000kbit prio 2
tc filter add dev br0 parent 1:0 protocol ip prio 2 u32 match u16 0x0800 0xFFFF at -2 match u32 0x00000000 0xFFFFFFFF at -12 match u16 0x0000 0xFFFF at -14 flowid 1:10
insmod imq
insmod ipt_mac
insmod ipt_IMQ
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 730kbit
tc class add dev imq0 parent 1:1 classid 1:10 htb rate 10kbit ceil 20kbit prio 2
iptables -t mangle -A PREROUTING -m mac --mac-source 00:00:00:00:00:00 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -j IMQ --todev 0
iptables -t mangle -I PREROUTING -j CONNMARK --restore-mark
iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark
mgalarneau
DD-WRT Novice


Joined: 02 Sep 2009
Posts: 7

PostPosted: Wed Sep 02, 2009 7:31    Post subject: Reply with quote
hello

my first post here but been reading for a few days, need to limit my brother from using all the banwitdh hehe , wasn't able to find and "easy"solution to simply impose a monthly cap ie 30-40 gig so instead I will be limiting his speed.

here is my script :

TCA="tc class add dev br0"
TFA="tc filter add dev br0"
TQA="tc qdisc add dev br0"
SFQ="sfq perturb 10"
tc qdisc del dev br0 root
tc qdisc add dev br0 root handle 1: htb
tc class add dev br0 parent 1: classid 1:1 htb rate 9500kbit
$TCA parent 1:1 classid 1:10 htb rate 512kbit ceil 512kbit prio 3
$TQA parent 1:10 handle 10: $SFQ
$TFA parent 1:0 protocol ip prio 3 u32 match u16 0x0800 0xFFFF at -2 match u32 0xA571FD18 0xFFFFFFFF at -12 match u16 0x0014 0xFFFF at -14 flowid 1:10
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
insmod imq
insmod ipt_IMQ
insmod ipt_mac
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 820kbit
$TCAU parent 1:1 classid 1:10 htb rate 100kbit ceil 100kbit prio 3
$TQAU parent 1:10 handle 10: $SFQ
iptables -t mangle -A PREROUTING -m mac --mac-source 00:xx:xx:xx:xx:xx -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -j IMQ --todev 0

Download speed is limited very well but it does not block upload speed.

what is wrong in my script to limit upload speed ?

thanks in advance !

MAt
Choco21
DD-WRT Novice


Joined: 07 Sep 2009
Posts: 1

PostPosted: Mon Sep 07, 2009 7:41    Post subject: Reply with quote
For anyone else following this from search or whatever, one thing I notice is that the actual bandwidth given is usually about 80% - 95% of what you specify per user. So you should account for that or else it might be slower than you intend.

Regards

Albert
__________
Pret immobilier
AlphaWolf
DD-WRT Novice


Joined: 26 Oct 2006
Posts: 7

PostPosted: Thu Apr 22, 2010 5:26    Post subject: Reply with quote
Any chance somebody could post an ipt_iprange module? I don't have a cross compiler setup.
andreiursan
DD-WRT Novice


Joined: 26 Aug 2011
Posts: 29

PostPosted: Mon Nov 28, 2011 9:43    Post subject: wl500g deluxe + build 14929 std + prioritize services Reply with quote
Hello friends. I am using a Asus wl500g deluxe router with the dd-wrt build 14929 and I want to generate a firewall script to prioritize the services , "automatically share bandwidth " between voip, mail. dc++, etc using the script generator v 1.02 . I am new on this and I want to know if there are other things to do , other than generating the script and to paste it in the startup. Also I want to know what device I have to use (br0,etc) if I want to use my Asus in client mode for a wireless connection or only like a broadband router , using the WAN port. Thank you.
BiLLY
DD-WRT Novice


Joined: 09 Jun 2009
Posts: 9

PostPosted: Sat Dec 28, 2013 22:50    Post subject: Upload not working Reply with quote
Download / Upload working on Asus RT-N66U (dd-wrt.v24-21402_NEWD_2_K2.6_mega-RT-N66_64K.trx)


Code:

#--------------------------------------------
#WRT54 Script Generator v1.02
#(C) 2006-2007 Robert "Robson" Mytkowski
#--------------------------------------------

# Limit Download to rateMb/s guaranteed, ceilMb/s max
TCA="tc class add dev br0"
TFA="tc filter add dev br0"
TQA="tc qdisc add dev br0"
SFQ="sfq perturb 10"
tc qdisc del dev br0 root
tc qdisc add dev br0 root handle 1: htb
tc class add dev br0 parent 1: classid 1:1 htb rate 10900kbit
$TCA parent 1:1 classid 1:10 htb rate 4096kbit ceil 8192kbit prio 2
$TCA parent 1:1 classid 1:11 htb rate 2048kbit ceil 6144kbit prio 2
$TQA parent 1:10 handle 10: $SFQ
$TQA parent 1:11 handle 11: $SFQ
$TFA parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
$TFA parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
iptables -t mangle -A POSTROUTING -d 192.168.2.105 -j MARK --set-mark 10
iptables -t mangle -A POSTROUTING -d 192.168.2.3 -j MARK --set-mark 11

# Limit Upload to rateMb/s guaranteed, ceilMb/s max
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
insmod ipt_IMQ
insmod imq
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 2430kbit
$TCAU parent 1:1 classid 1:10 htb rate 512kbit ceil 1024kbit prio 2
$TCAU parent 1:1 classid 1:11 htb rate 256kbit ceil 1024kbit prio 2
$TQAU parent 1:10 handle 10: $SFQ
$TQAU parent 1:11 handle 11: $SFQ
$TFAU parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
$TFAU parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
iptables -t mangle -A PREROUTING -s 192.168.2.105 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -s 192.168.2.3 -j MARK --set-mark 11
iptables -t mangle -A PREROUTING -j IMQ --todev 0
alllexx
DD-WRT Novice


Joined: 03 Aug 2014
Posts: 41
Location: Kyiv, Ukraine

PostPosted: Mon Aug 04, 2014 5:43    Post subject: Reply with quote
Hi all,
I want to limit download/upload speed for bridge br1 (guest network). Will the following work?

Code:
#--------------------------------------------
#WRT54 Script Generator v1.02
#(C) 2006-2007 Robert "Robson" Mytkowski
#--------------------------------------------

# Limit Download to rateMb/s guaranteed, ceilMb/s max
TCA="tc class add dev br1"
TFA="tc filter add dev br1"
TQA="tc qdisc add dev br1"
SFQ="sfq perturb 10"
tc qdisc del dev br1 root
tc qdisc add dev br1 root handle 1: htb
tc class add dev br1 parent 1: classid 1:1 htb rate 10900kbit
$TCA parent 1:1 classid 1:10 htb rate 4096kbit ceil 8192kbit prio 2
$TQA parent 1:10 handle 10: $SFQ
$TFA parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
iptables -t mangle -A POSTROUTING -i br1 -j MARK --set-mark 10

# Limit Upload to rateMb/s guaranteed, ceilMb/s max
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
insmod ipt_IMQ
insmod imq
ip link set imq0 up
tc qdisc del dev imq0 root
tc qdisc add dev imq0 root handle 1: htb
tc class add dev imq0 parent 1: classid 1:1 htb rate 2430kbit
$TCAU parent 1:1 classid 1:10 htb rate 512kbit ceil 1024kbit prio 2
$TQAU parent 1:10 handle 10: $SFQ
$TFAU parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
iptables -t mangle -A PREROUTING -o br1 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -j IMQ --todev 0


Sorry, I can't test it myself atm.

TIA,
Alex
Goto page Previous  1, 2 Display posts from previous:    Page 2 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum