I need to build a test environment with a very precise packet loss based on specific TCP sequence or, optionally, on payload content. I couldn't figure out how to do it with tc or iptables. What tool should I use?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Moving on to the TCP header
Let's say I'd like to look at bytes 4-7 of the TCP header (the TCP sequence number)...
The final expression (check for TCP, check for unfragmented packet or first fragment, and jump over the IP header, checking that bytes 4-7 of the TCP header are equal to 41) is:
iptables -m u32 --u32 "6&0xFF=0x6 && 4&0x1FFF=0 && 0>>22&0x3C@4=0x29"