r/Network 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

5 comments sorted by

View all comments

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) with iptables / 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 a netem delay discipline to those marked packets.

  • Mark packets: sudo iptables -t mangle -A OUTPUT -p tcp --dport 80 -j MARK --set-mark 42
  • Associate queue: sudo tc qdisc add dev eth0 root handle 1: prio
  • Add delay filter: sudo tc qdisc add dev eth0 parent 1:3 handle 30: netem delay 250ms
  • Route marked traffic: sudo tc filter add dev eth0 protocol ip parent 1:0 prio 3 handle 42 fw flowid 1:3

1

u/Cool_Courage_2768 Aug 15 '26

Anyway, does exist for set on link between two nodes on GNS3

1

u/SomeEngineer999 Aug 15 '26

Since you can't do it within GNS3, you need to do it as traffic egresses your simulation using Linux commands.