Packet loss only on Tx using tc(Traffic Control) in Linux

tc

I'm aware that one can introduce packet loss in a Linux machine using tc. For example:

tc qdisc change dev eth0 root netem loss 10%

However, is it possible to specify a traffic direction where the packet loss occurs? I would like to have no packet loss on receive, but 10% packet loss on transmit for testing purposes.

Best Answer

As far as I know, specifying a qdisc in the above way means an egress qdisc only. So you should only see 10% loss on egress traffic from eth0.

To do the same for ingress traffic you'd need to use something like an intermediate functional block pseudo device, where you redirect ingress traffic on eth0 to the egress queue of a pseudo device (e.g. ifb0) and shape/queue on that device. See here for more details http://www.linuxfoundation.org/collaborate/workgroups/networking/netem