bugcy013
6/23/2014 - 6:13 PM

packet drop simulator

packet drop simulator

#!/bin/bash


if [ $# -eq 0 ]
   then
    echo " "
    echo "------------------------------------------"
    echo "off     = clear all netem [Packet Drop] profiles"
    echo "show    = show active profiles"
    echo "enable_packet_drop   = enable enable_packet_drop netem profile"
    echo ""
   exit
 fi

if [ $1 = "off" ]
   then
     echo "netem profile off"
     tc qdisc del dev eth0 root netem
   exit
 fi

if [ $1 = "show" ]
   then
     echo "show netem profile"
     tc qdisc show dev eth0
   exit
 fi

if [ $1 = "enable_packet_drop" ]
   then
     tc qdisc add dev eth0 root netem delay 200ms 40ms 25% loss 15.3% 25% duplicate 1% corrupt 0.1% reorder 25% 50%
   exit
 fi

##

##