Simulating Latency

Lots of incredibly old and hard ways of simulating latency on a link in Linux on the Googleweb

But it’s easy with tc(8) – tc – show / manipulate traffic control settings

example (virtual0 is a KVM host, the Windows machine is a VM on a different host, same LAN)

virtual0:/home/chrisl/ 30$ sudo modprobe ifb
virtual0:/home/chrisl/ 31$ sudo ip link set dev ifb0 up
virtual0:/home/chrisl/ 32$ sudo tc qdisc add dev eth0 ingress
virtual0:/home/chrisl/ 33$ sudo tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0
virtual0:/home/chrisl/ 34$ sudo tc qdisc add dev ifb0 root netem delay 146ms

C:\Documents and Settings\chrisl.VC>ping -t kdms9.example.com

Pinging kdms9.example.com [10.233.0.155] with 32 bytes of data:

Reply from 10.233.0.155: bytes=32 time=158ms TTL=255
Reply from 10.233.0.155: bytes=32 time=157ms TTL=255
Reply from 10.233.0.155: bytes=32 time=155ms TTL=255
Reply from 10.233.0.155: bytes=32 time=158ms TTL=255

Ping statistics for 10.233.0.155:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 155ms, Maximum = 158ms, Average = 157ms

virtual0:/home/chrisl/ 35$ sudo tc qdisc del dev ifb0 root netem delay 146ms

Comments

    Leave a comment