7

I want each packet (that match iptables rule) to be delayed by some fixed time interval. How to to this?

Preudocode: iptables -A INPUT -p udp <more conditions> -j DELAY --delay 50000 # delay UDP packets for 50 milliseconds

Update: @related Simulating a low-bandwidth, high-latency network connection on Linux

2
  • Why? Testing purposes?
    – Shinrai
    Aug 9, 2010 at 22:23
  • Yes, testing/debugging. Actually tc qdisc add dev eth1 root netem delay 250ms helped.
    – Vi.
    Aug 12, 2010 at 9:51

1 Answer 1

8

tc qdisc add dev eth1 root netem delay 250ms hack allows to do it globally for the given interface. It includes UDP packets.

It delays outgoing packets only although. For incoming packets you can route packets though a virtual router (created by separate network namespace and veth with netem attached to veth side of link).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .