Réseau Linux tc (Traffic Control)
Introduction to Network Emulation with tc (Traffic Control) The tc command is part of the iproute package
Source : https://bencane.com/simulating-network-latency-for-testing-in-linux-environments-29daad98efcc
tc (Traffic Control) is a powerful Linux command used to control the kernel's network scheduler. It interfaces with a component known as netem (Network Emulator), which provides functionalities for emulating network conditions like latency, packet loss, and more. This tool is crucial for replicating real-world network scenarios, such as a WAN, within a controlled test environment.
Determine Current Latency: Use the ping command to measure the current latency to a remote server.
ping google.com
Calculate Additional Latency: Subtract the average current latency from your desired latency.
Desired Latency - Current Latency = Additional Latency
Apply the Latency using tc : Use the tc command to add the calculated delay to the network interface.
tc qdisc add dev eth0 root netem delay 97ms
Verify the Rule : Use the tc -s command to ensure the delay has been correctly added.
tc -s qdisc
Removing the Latency Rule
tc qdisc del dev eth0 root netem
