View Single Post

  #1  
Old 08-20-2008, 11:32 AM
Default tc to slow traffic to one port

Hello All,
I'm trying to use tc to introduce a 5 second delay to connections to a
certain port on my machine - mainly to test the effect of latency on
an application. Here is the script I'm using:

#!/bin/bash
I=eth0
PORT=8887
tc qdisc del dev $I root
tc qdisc add dev $I handle 1: root htb
tc class add dev $I parent 1: classid 1:1 htb rate 100Mbps
tc qdisc add dev $I parent 1:1 handle 10: netem delay 5000ms
tc filter add dev $I protocol ip parent 1: prio 1 u32 match \
ip dport $PORT 0xffff flowid 10:
tc filter add dev $I protocol ip parent 1: prio 1 u32 match \
ip sport $PORT 0xffff flowid 10:

It runs without error, but I don't notify any delays, whether I hit
the port from my current machine or from another.

I already tried just slowing localhost like this:

#!/bin/bash
tc qdisc del dev lo root
tc qdisc add dev lo root netem delay 5000ms

and that worked great. However, I need to add this port restriction.
Is there anything wrong with my tc commands? Is the filter even being
run, and is there some place I can monitor what they are doing?

Thank you for your assistance.
Reply With Quote