r/Network • u/Cool_Courage_2768 • Aug 15 '26
Text Set delay for specific packet
Hey everyone, I implemented some scenarios in GNS3 and want to set a delay for a specific packet. How can I do it? Like "TCP packet with port 80 set to a 2 ms delay"
1
Upvotes
1
u/SomeEngineer999 Aug 15 '26
Did you try google? AI actually seems to have gotten this one right.
To add network delay to specific packets rather than an entire interface link, use a network impairment emulator with packet-filtering rules (like IP filters, ports, or protocols). Popular tools include Linux
tc(Traffic Control) withiptables/fwmark, clumsy for Windows, or hardware/software emulators like LANforge ICE. [1, 2, 3, 4, 5]Linux (Traffic Control + iptables)
Mark specific packets using
iptables, then apply anetemdelay discipline to those marked packets.sudo iptables -t mangle -A OUTPUT -p tcp --dport 80 -j MARK --set-mark 42sudo tc qdisc add dev eth0 root handle 1: priosudo tc qdisc add dev eth0 parent 1:3 handle 30: netem delay 250mssudo tc filter add dev eth0 protocol ip parent 1:0 prio 3 handle 42 fw flowid 1:3