On Tue, 2007-06-19 at 13:47 +0200, Joost Kraaijeveld wrote: > Hi, > > Can anyone point me out where the script below is wrong?
Maybee, I'm new to this stuff and having trouble getting some things to work myself. :S > All I want is that host 172.31.1.1 can only use 10 megabit. If I run > this script on the in-between router nothing happens (the host uses > still the full 100 mbit, tested with iperf) , so i assume that something > must be wrong.... > > > #!/bin/sh > > # LAN1 NIC > tc qdisc del dev eth0 root > tc qdisc add dev eth0 root handle 1: htb > tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit > > # my machine > tc class add dev eth0 parent 1:1 classid 1:2 htb rate 1mbit ceil 10mbit One thing I find useful (especially when debugging) is to replace the default fifo qdisc on the leaf with one that _does_ maintain statistics - which you can see with 'tc -s qdisc show dev ...'. Makes it a bit easier to see where your traffic is going, and if that matches your expectations/intentions. > # filter > tc filter add dev eth0 parent 1:1 protocol ip prio 1 u32 match ip dst > 172.31.1.1 flowid 1:2 > Try attaching the filter to the root qdisc (parent 1:0). What I think might be happening is that the root qdisc had no idea what to do with the packets - there are no filters there, and you did not specify a "default" class. So it just sends the packets directly to the interface. Or you could try adding "default 1" to the root htb qdisc. From there your filter should do the rest. Only I don't know if "default" can point to a non-leaf class, if you try let me know if it works or not. HTH, Mark. > # LAN2 NIC > tc qdisc del dev eth1 root > tc qdisc add dev eth1 root handle 1: htb > tc class add dev eth1 parent 1: classid 1:1 htb rate 100mbit > > # my machine > tc class add dev eth1 parent 1:1 classid 1:2 htb rate 1mbit ceil 10mbit > > # filter > tc filter add dev eth1 parent 1:1 protocol ip prio 1 u32 match ip src > 172.31.1.1 flowid 1:2 > > > TIA > _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc