Steps for Permanently limit Bandwidth of a PC using DD-WRT ?

Post new topic   Reply to topic    DD-WRT Forum Index -> Ralink SoC based Hardware
Goto page 1, 2  Next
Author Message
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Sun Nov 04, 2012 14:59    Post subject: Steps for Permanently limit Bandwidth of a PC using DD-WRT ? Reply with quote
I've just Flashed DD-WRT to my D-Link DIR-600 Router.. My only motive to flash DD-WRT was to Limit the Bandwidth of my roommate's PC on my network.. I have a 2mbps Broadband Connection(Bill paid by me) which is shared over my DIR-600 Wifi router..
My Broadband Plan has a 15GB full speed(2mbps) Download limit after which the speed would reduce to 256kbps..
So, i want to limit that specific PC of my roommate to a bandwidth of 512kbps permanently (even when my PC is switched off).. And only i should get the whole bandwidth of 2mbps on my PC and phone..
I've read a lot of DD-WRT QoS Tutorials but i still haven't found the proper steps to achieve all of this..??
Sponsor
jfish99
DD-WRT User


Joined: 25 Aug 2011
Posts: 112

PostPosted: Sun Nov 04, 2012 19:46    Post subject: Reply with quote
you could create guess wifi network, give your housemate access to that and then restrict bandwidth

I have successfully implemented on this for a small company who hire out meeting rooms and wanted to provide wifi access but with limited bandwidth

as far as I know QoS on ddwrt doesnt work too well.
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Mon Nov 05, 2012 6:28    Post subject: Reply with quote
jfish99 wrote:
you could create guess wifi network, give your housemate access to that and then restrict bandwidth

I have successfully implemented on this for a small company who hire out meeting rooms and wanted to provide wifi access but with limited bandwidth

as far as I know QoS on ddwrt doesnt work too well.


How to Set a guest account and limit its bandwidth??
Also, will it reduce the signal strength if we set Two wifi networks on a Single Channel Wifi Router..??
jfish99
DD-WRT User


Joined: 25 Aug 2011
Posts: 112

PostPosted: Mon Nov 05, 2012 9:03    Post subject: Reply with quote
wont effect wireless strength ..

see attached document, this is done for a WAP (as in the router is connected via a cat6 cable to the main router that provides internet access). so you will need some changes on the iptables bit

also read this http://www.dd-wrt.com/wiki/index.php/Multiple_WLANs
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Mon Nov 05, 2012 10:02    Post subject: Reply with quote
jfish99 wrote:
wont effect wireless strength ..

see attached document, this is done for a WAP (as in the router is connected via a cat6 cable to the main router that provides internet access). so you will need some changes on the iptables bit

also read this http://www.dd-wrt.com/wiki/index.php/Multiple_WLANs


That guide helps us to make another SSID.. But, after that how can i apply Download and Upload Bandwidth Cap to that network ??
jfish99
DD-WRT User


Joined: 25 Aug 2011
Posts: 112

PostPosted: Mon Nov 05, 2012 10:06    Post subject: Reply with quote
read my pdf the section you want is

Code:
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 1024kbit
$TQA parent 1:1 handle 10: $SFQ
$TFA parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:1
iptables -t mangle -A POSTROUTING -d 192.168.100.0/24 -j MARK --set-mark 10
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
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 512kbit
$TQAU parent 1:1 handle 10: $SFQ
$TFAU parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:1
iptables -t mangle -A PREROUTING -s 192.168.100.0/24 -j MARK --set-mark 10


change subnet to reflect yours and also the upload bit doesnt work for some reason.. still investigating this issue.
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Mon Nov 05, 2012 10:25    Post subject: Reply with quote
Can't i just use the QoS feature in DD-WRT and set that pc to 'Bulk' priority to reduce its bandwidth ??
jfish99
DD-WRT User


Joined: 25 Aug 2011
Posts: 112

PostPosted: Mon Nov 05, 2012 10:27    Post subject: Reply with quote
varunmehta11 wrote:
Can't i just use the QoS feature in DD-WRT and set that pc to 'Bulk' priority to reduce its bandwidth ??


as far as I am aware QoS on ddwrt doesnt work too well.. but you can try if you wish.

The iptables I use work perfectly.
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Mon Nov 05, 2012 12:01    Post subject: Reply with quote
jfish99 wrote:
read my pdf the section you want is

Code:
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 1024kbit
$TQA parent 1:1 handle 10: $SFQ
$TFA parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:1
iptables -t mangle -A POSTROUTING -d 192.168.100.0/24 -j MARK --set-mark 10
TCAU="tc class add dev imq0"
TFAU="tc filter add dev imq0"
TQAU="tc qdisc add dev imq0"
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 512kbit
$TQAU parent 1:1 handle 10: $SFQ
$TFAU parent 1:0 prio 2 protocol ip handle 10 fw flowid 1:1
iptables -t mangle -A PREROUTING -s 192.168.100.0/24 -j MARK --set-mark 10


change subnet to reflect yours and also the upload bit doesnt work for some reason.. still investigating this issue.


Can you please tell me what are those two htb rates mentioned above( 1024kbit and 512kbit).??
Will these settings effect my main network which i would be using and, also does all these changes reversible(revert back to default settings)??


Last edited by varunmehta11 on Mon Nov 05, 2012 12:21; edited 1 time in total
jfish99
DD-WRT User


Joined: 25 Aug 2011
Posts: 112

PostPosted: Mon Nov 05, 2012 12:08    Post subject: Reply with quote
The DNSMasq settings allow the subnet we have created for the guess wifi spot to have its own dhcp server and allocate IP addresses from this pool.

the htb settings refer to the allows bandwidth for upload and download and you would adjust this to what you want.

The settings will only effect the guess wifi network and not your main network.

I suggest you do more reading on this to get a better understanding of how it all works.
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Mon Nov 05, 2012 12:27    Post subject: Reply with quote
jfish99 wrote:
The DNSMasq settings allow the subnet we have created for the guess wifi spot to have its own dhcp server and allocate IP addresses from this pool.

the htb settings refer to the allows bandwidth for upload and download and you would adjust this to what you want.

The settings will only effect the guess wifi network and not your main network.

I suggest you do more reading on this to get a better understanding of how it all works.


I guess htb rate 1024kbit is for Download bandwidth and htb 512kbit is for Upload bandwidth
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Mon Nov 05, 2012 12:45    Post subject: Reply with quote
Also.. Don't i need to add these lines in the iptables.??

iptables -I FORWARD -i br1 -d `nvram get lan_ipaddr`/`nvram get lan_netmask` -m state --state NEW -j DROP
iptables -t nat -I POSTROUTING -o br0 -j SNAT --to `nvram get lan_ipaddr`
iptables -I INPUT -i br1 -m state --state NEW -j DROP
iptables -I INPUT -i br1 -p udp --dport 67 -j ACCEPT
iptables -I INPUT -i br1 -p udp --dport 53 -j ACCEPT
iptables -I INPUT -i br1 -p tcp --dport 53 -j ACCEPT
jfish99
DD-WRT User


Joined: 25 Aug 2011
Posts: 112

PostPosted: Mon Nov 05, 2012 12:47    Post subject: Reply with quote
varunmehta11 wrote:
Also.. Don't i need to add these lines in the iptables.??

iptables -I FORWARD -i br1 -d `nvram get lan_ipaddr`/`nvram get lan_netmask` -m state --state NEW -j DROP
iptables -t nat -I POSTROUTING -o br0 -j SNAT --to `nvram get lan_ipaddr`
iptables -I INPUT -i br1 -m state --state NEW -j DROP
iptables -I INPUT -i br1 -p udp --dport 67 -j ACCEPT
iptables -I INPUT -i br1 -p udp --dport 53 -j ACCEPT
iptables -I INPUT -i br1 -p tcp --dport 53 -j ACCEPT


yes you need to in order to restrict access to your main network. Also the above relates to the secondary router set up as a WAP - you will need to change the lan_ipaddress to wan_ipaddress.
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Mon Nov 05, 2012 12:56    Post subject: Reply with quote
jfish99 wrote:
varunmehta11 wrote:
Also.. Don't i need to add these lines in the iptables.??

iptables -I FORWARD -i br1 -d `nvram get lan_ipaddr`/`nvram get lan_netmask` -m state --state NEW -j DROP
iptables -t nat -I POSTROUTING -o br0 -j SNAT --to `nvram get lan_ipaddr`
iptables -I INPUT -i br1 -m state --state NEW -j DROP
iptables -I INPUT -i br1 -p udp --dport 67 -j ACCEPT
iptables -I INPUT -i br1 -p udp --dport 53 -j ACCEPT
iptables -I INPUT -i br1 -p tcp --dport 53 -j ACCEPT


yes you need to in order to restrict access to your main network. Also the above relates to the secondary router set up as a WAP - you will need to change the lan_ipaddress to wan_ipaddress.


Sorry to bother you.. As i'm a novice. Can you please tell me which lines from above do i have to add.? I have my Wifi router connected through a cat6 cable to an ADSL Modem..
varunmehta11
DD-WRT Novice


Joined: 04 Nov 2012
Posts: 13

PostPosted: Wed Nov 07, 2012 20:42    Post subject: jfish99 Method working perfectly.. Reply with quote
Woww.. Very Happy Very Happy The method mentioned by jfish99 Worked like a charm..
Thnx a lot..!! Smile
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Ralink 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 cannot attach files in this forum
You cannot download files in this forum