Friday, August 14, 2015

Emulating wide area network delays

http://www.linuxfoundation.org/collaborate/workgroups/networking/netem

This is the simplest example, it just adds a fixed amount of delay to all packets going out of the local Ethernet.

# tc qdisc add dev eth0 root netem delay 100ms

Real Examples:

[root@localhost ~]# ifconfig -a
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.56.101  netmask 255.255.255.0  broadcast 192.168.56.255
        inet6 fe80::a00:27ff:fe02:dadb  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:02:da:db  txqueuelen 1000  (Ethernet)
        RX packets 836  bytes 75866 (74.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 652  bytes 74833 (73.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost ~]# tc qdisc add dev enp0s3 root netem delay 100ms
[root@localhost ~]# tc qdisc show dev enp0s3
qdisc netem 8002: root refcnt 2 limit 1000 delay 100.0ms
[root@localhost ~]# tc qdisc delete dev enp0s3 root netem delay 100ms
[root@localhost ~]# tc qdisc show dev enp0s3
qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1

The below screenshot of ping clearly demonstrates the latency added (100ms).

image

No comments:

Post a Comment