Hi. I am wondering if there is a way to rate limit computer by IP address or MAC address on DLINK ADSL modems.
If there is a more appropriate place to post this question please feel welcome to tell me - I couldn't see anything any better than this random location in the forum
The common examples I have seen involve using iptables, which the current DLINK modem I use has (DLINK G604T, formware V3.00B01T01.TX.20060516).
However, none of the examples work, and I'm not experienced enough with iptables/tc/ismod etc to guess why or figure out a workaround.
One of the simple examples I have is this script, designed to give the user of IP 10.1.1.100 and 10.1.1.180 high throughput, and ratelimit the user with IP 10.1.1.184.
Once the insmod imq command is used error message abound and none of the subsequent commands are accepted either.
Does anyone here know enough to tell me what is going wrong and suggest a workaround?
Cheers,
Mark
#Based on http://www.dd-wrt.com/phpBB2/viewtopic.php?p=241408
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 2500kbit
tc class add dev br0 parent 1:1 classid 1:10 htb rate 1000kbit ceil 1000kbit prio 2
tc class add dev br0 parent 1:1 classid 1:11 htb rate 50kbit ceil 70kbit prio 2
tc filter add dev br0 parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
tc filter add dev br0 parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
iptables -t mangle -A POSTROUTING -d 10.1.1.100 -j MARK --set-mark 10
iptables -t mangle -A POSTROUTING -d 10.1.1.180 -j MARK --set-mark 10
iptables -t mangle -A POSTROUTING -d 10.1.1.184 -j MARK --set-mark 11
insmod imq
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 400kbit
tc class add dev imq0 parent 1:1 classid 1:10 htb rate 50kbit ceil 200kbit prio 2
tc class add dev imq0 parent 1:1 classid 1:11 htb rate 2kbit ceil 10kbit prio 2
tc filter add dev imq0 parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:10
tc filter add dev imq0 parent 1:0 prio 2 protocol ip handle 11 fw flowid 1:11
iptables -t mangle -A PREROUTING -s 10.1.1.100 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -s 10.1.1.180 -j MARK --set-mark 10
iptables -t mangle -A PREROUTING -s 10.1.1.184 -j MARK --set-mark 11
iptables -t mangle -A PREROUTING -j IMQ --todev 0