- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to simulate delayed and dropped packets on Linux?
In order to simulate the packages that got delayed or dropped we can make use of the netem which provides us with a network emulation functionality that is helpful in testing protocols.
The way netem works is that it tests the protocols by emulating the properties of wide area networks.
There are different versions of netem and the current stable version allows us to emulate variable delay, loss, re-ordering and duplication of packets.
There are two ways in which we can use the network emulator, the first is the most basic one where we can enable the netem kernel component by following the simple steps mentioned below
Networking -> Networking Options -> QoS and/or fair queuing -> Network emulator
Or we can make use of the command line, as the command line tool ‘tc’ is used for the netem kernel.
Let’s explore a few different examples of the command line tool tc, where we will first emulate a wide area of network delays then we will talk about the packet loss.
Emulating wide network delays
# tc qdisc add dev eth0 root netem delay 100ms
Now, if we do a simple ping test to our host on the local network. then we will see an increase of 100 milliseconds. The delay is normally limited by the clock resolution of the kernel (HZ).
We can also cause a delay without changing the qdisc, for that please consider the command shown below −
# tc qdisc change dev eth0 root netem delay 100ms 10ms
The above command will cause the added delay to be 100ms ± 10ms.
We can specify the packet loss in the ‘tc’ command with the help of the percentages.
Consider the command shown below that simulates the same.
# tc qdisc change dev eth0 root netem loss 0.1%
The above command will cause 1/10th of a percent (i.e., 1 out of 1000) packets to be randomly dropped.
- How to compile and execute C# programs on Linux?
- How to Search and Remove Directories Recursively on Linux?
- How to Install and Configure NFS Server on Linux
- How To Configure and Install Redis on Ubuntu Linux
- How to Install Git on Linux
- How to activate virtualenv on Linux?
- How to Install and Configure Squid Proxy Server on Linux
- What is delayed branching?
- How to Install and Configure an NTP Client and Server on Linux?
- How OSPF routes the packets from source to destination?
- How to Install C++ Compiler on Linux?
- How to configuring Java Environment on Linux?
- How to Join Several Partitions on Linux
- How to limit network bandwidth on linux
- How to Install Atom 1.6.0 on Linux