tc to slow traffic to one port

This is a discussion on tc to slow traffic to one port within the Networking forums, part of the Help category; 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 ...

Go Back   Unix Linux Forum > Unix > Linux > Help > Networking

FixUnix.com - Unix Linux Forums

Unix Content Register FAQ Calendar Search Today's Posts Mark Forums Read
  #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
  #2  
Old 08-21-2008, 07:04 PM
Default Re: tc to slow traffic to one port

dustmop wrote:
> 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.


The flowid should be 1:1

Andy.
Reply With Quote
Reply

Thread Tools


All times are GMT -5. The time now is 06:32 PM.

In an effort to better serve ads to our visitors, cookies are used on Fixunix.com. For more information, check out our Privacy Policy.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Ad Management by RedTyger