How to delay some localhost traffic? (the computer is a VM, but hopefully that won't matter)
The following creates a new interface and tries to apply tc
to it:
ifconfig lo:1 127.0.10.10 netmask 255.0.0.0 up
tc qdisk add dev lo:1 root netem delay 200ms
This also limited traffic for the normal loopback interface:
$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=400 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=400 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=400 ms
The same delay appeared for 127.0.10.10
and when pinging the device's IP address.
How to delay only a part of localhost traffic? (f.ex. to a specific IP address?)
UPDATE: Removing the tc qdisk
, creating a new interface using ip link add link lo name lo30 type dummy
and setting tc
on it did not delay any traffic. Seems like all traffic to the local computer is automatically routed to lo
.
lo
interface and the 127/8 subnet? The former may be special, and the latter may certainly be special. You could set up a small subnet carved out of RFC 1918 space with no external routing to achieve pretty much the exact same effect, but if you need to use 127/8 that's obviously not an option.man tc-netem
).