1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

speed limiting. Noob needs help

Discussion in 'DD-WRT Firmware' started by Mintj, Apr 30, 2006.

  1. Mintj

    Mintj LI Guru Member

    Hi, i've just got my Linksys dwr54g (v4 thankfully). And the only reason I got it was to set a hard bandwidth limit (e.g. 50 kbps) for a certain MAC or IP address (because my room mate is a *beep* with all his bittorrenting.

    I've searched the entire web for any clues but without success where people keep teling me to do a "tc" command.

    1) is there anything that's GUI that does the what I am asking for?

    2) if no, can you experts give me an example of how to actually perform the "tc" command (on DD wrt)? I am new to Linux and will be very grateful for your expertise.

    Thank you
     
  2. Mintj

    Mintj LI Guru Member

    also I have tried that Qos feature, but it doesn't quite fit the task. I need to enforce a rate. I don't mean a quota (eg 2 gb a month) but a rate like 50 kbps
     
  3. primus1024

    primus1024 Network Guru Member

  4. Mintj

    Mintj LI Guru Member

    can you atleast limit a specific IP on the router to a specific bandwidt instead of a MAC?
     
  5. kidkl

    kidkl Network Guru Member

    Here is the setup I was using for wireless not to long ago. Sim situation roommate on wireless would take up most of the bandwidth so we knocked him down to ~80k/s. This however still allowed fullspeed transfers over the wireless. Just anything outbound was limited.

    You should be able to play with the devices and the IP's to suite your needs.

    Code:
    tc class add dev eth1 parent 1: classid 1:10 htb rate 53mbit burst 6k prio 1
    tc class add dev eth1 parent 1:1 classid 1:20 htb rate 140kbit burst 6k prio 2
    tc filter add dev eth1 parent 1: protocol ip prio 13 u32 match ip src 192.168.0.0/23 match ip dst 0.0.0.0/0 flowid 1:20
    tc filter add dev eth1 parent 1: protocol ip prio 1 u32 match ip src 192.168.0.0/23 match ip dst 192.168.0.0/23 flowid 1:10
    tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10
    tc qdisc add dev eth1 parent 1:20 handle 20: sfq perturb 10
    
    
    tc qdisc add dev br0 handle ffff: ingress
    tc filter add dev br0 parent ffff: protocol ip prio 50 u32 match ip src 192.168.0.0/23 match ip dst 192.168.0.0/23 police rate 100mbit burst 10k drop flowid :1
    tc filter add dev br0 parent ffff: protocol ip prio 51 u32 match ip src 192.168.0.101/32 match ip dst 0.0.0.0/0 police rate 1mbit burst 10k drop flowid :2
    tc filter add dev br0 parent ffff: protocol ip prio 52 u32 match ip src 192.168.0.102/32 match ip dst 0.0.0.0/0 police rate 1mbit burst 10k drop flowid :3
    tc filter add dev br0 parent ffff: protocol ip prio 53 u32 match ip src 192.168.0.121/32 match ip dst 0.0.0.0/0 police rate 1mbit burst 10k drop flowid :4
    tc filter add dev br0 parent ffff: protocol ip prio 55 u32 match ip src 192.168.0.0/23 match ip dst 0.0.0.0/0 police rate 80kbit burst 10k drop flowid :5
    
     
  6. Mintj

    Mintj LI Guru Member

    thank you sooo much! but some comments on the code would be greatly appreciated
     
  7. Impreza

    Impreza LI Guru Member

    I got the same problem, roommates who take too much bandwith.. but not quite on purpose. Instead of installing NetLimiter on all client pcs, I'd rather limit bandwith on the router.
    But I don't quite get the code above, where should I enter all this? Coz it doesnt work directly in SSH. I'm btw using HyperWRT at the moment, perhaps that makes the difference?
     

Share This Page