An example of restricting all traffic corresponding to tcp (protocol 6) of destination port 54000 with incoming 256 Kbps on eth0 using tc ...
As root ...
tc qdisc add dev eth0 handle ffff: ingress tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 \ match ip protocol 6 0xff \ match ip dport 54000 0xffff police rate 256kbit burst 10k drop \ flowid :1
You can track it like this: pay attention to the dropped number for ffff below
[ mpenning@Bucksnort ~]$ sudo tc -s qdisc show qdisc pfifo_fast 0: dev eth0 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 Sent 17796311917 bytes 5850423 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 qdisc ingress ffff: dev eth0 parent ffff:fff1
To remove all input traffic filters:
tc qdisc del dev eth0 ingress
Mike pennington
source share