Thursday, October 29, 2015

Network Delay Generation

If for any testing you would like to generate network delay you can use the software tool netem. I used the instruction in the web site below for setting up netem.

http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#How_come_first_ping_takes_longer.3F

I am going to explain a simple setup you can use this tool to test the effect of network delay on network protocols,

1. Introduce ping round trip delay,
























2. At the Ubuntu desktop enter the following commands in the shell 

For delay d1 ,

shell# tc qdisc add dev eth0 root netem delay 100ms


For delay d2 (need to create a ifb interface),

shell#  modprobe ifb
shell#  ip link set dev ifb0 up
shell#  tc qdisc add dev eth0 ingress
shell#  tc filter add dev eth0 parent ffff: \ protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0
shell#  tc qdisc add dev ifb0 root netem delay 750ms


3. Now ping from any client to the Ubuntu box 172.16.1.177 and the ping round trip delay will be around 850ms,



















4. Lets say you want to change the delay d1 and d2, use the two commands below,

shell# tc qdisc change dev eth0 root netem delay d1ms
shell#  tc qdisc change dev ifb0 root netem delay d2ms


5. To remove network delay,

shell# tc qdisc del dev eth0 root netem delay d1ms
shell#  tc qdisc del dev ifb0 root netem delay d2ms



6. I used this to test the effect of network delay on NTP. The NTP server was installed in the Ubuntu box (apt-get install ntp) and introduced a 60 second delay to see whether the client failed time sync,








No comments: