Corruption using linux traffic control (tc command)

Pranooy asked:

I am kinda new to doing traffic control using Linux tc commands. So i am doing some hands-on on introducing network delay, packet loss and corruption etc across two hosts in the same network. The below commands were used to corrupt all traffic from port 20786 in Host A to port 202 in Host machine B.

sudo tc qdisc add dev eth0 root handle 1: prio priomap 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
sudo tc qdisc add dev eth0 parent 1:2 handle 20: netem corrupt 30%
sudo tc filter add dev eth0 parent 1:0 protocol ip u32 match ip sport 20786 0xffff flowid 1:2
sudo tc filter add dev eth0 parent 1:0 protocol ip u32 match ip dport 202 0xffff flowid 1:2

How do i make sure the packets will be corrupted? I am asking this because won’t there be TCP error control which make sure that the packets don’t get corrupted?

My answer:


If packets are corrupt then they will be dropped at the destination and the source will (eventually) retransmit them. So you will see a lot of retransmits in Wireshark. At 30% corruption the connection will have a LOT of them and thus be very slow.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.