Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been playing with tc on my local machine. sudo tc qdisc add dev eth0 root netem delay 2000ms adds a 2-second latency to all traffic going through eth0.

What I want is to be able to limit this latency to certain websites. I've tried playing with filters on specific IP addresses (Google's, for instance) but nothing seems to work.

Any ideas on how I can do this using tc? Is it the best tool for the job?

share|improve this question

You can mark packets with iptables in the mangle table and assign a class id to shape with tc.

The lartc.org site has very detailed informations on how to do it (and much more).

share|improve this answer
You should also be able to use the u32 classifier to tc filter instead of iptables. – Kjetil Jorgensen Feb 26 '11 at 19:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.