Bering-uClibc 4.x - User Guide - Advanced Topics - Setting Up a Network Emulator

From bering-uClibc
Revision as of 16:37, 20 February 2011 by Davidmbrooke (Talk | contribs) (Changed navigation links for new Bridge chapter)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Advanced Topics - Setting Up a Network Emulator
Prev Bering-uClibc 4.x - User Guide Next


Following the upgrade to version 2.6 of the Linux kernel, Bering-uClibc 4.x now includes the "netem" kernel Module which can be used in a test environment to simulate the effect of wide-area network characteristics such as high latency and packet loss.

The netem project page is here and contains simple usage instructions and FAQs. There is also a PDF file with a useful conference paper from 2005 here.

In summary, netem is an advanced network traffic Queueing Discipline (qdisc) for the Linux kernel, just like pfifo_fast or tbf. Like the other qdiscs it acts on packets sent by a particular network interface, in this case providing options to:

  • Delay packets, to simulate network latency
    • In addition to a simple fixed delay there are advanced options to apply a variable delay to better emulate real-world network conditions
  • Drop packets, to simulate packet loss
  • Duplicate and re-order packets
  • Corrupt packets

While netem itself does not apply rate control (e.g. to simulate a low-bandwidth link) it can be used in conjunction with other qdiscs which do that.

Since netem is implemented as a qdisc, a LEAF machine with netem installed can be deployed in a variety of different network topologies. For example:

  • As a transparent Bridge, connected between a client PC and its upstream network connection, where it has the effect of emulating a Wide Area Network link between the client PC and the rest of the network
  • As part of a Router / Firewall installation

This guide uses the Bridge deployment model as an example, using netem along with tbf to emulate a high-latency and low-bandwidth WAN link.

Software Installation


There is currently (as of Bering-uClibc 4.0-beta2, 2011-01-31) no specific Package for netem, although consideration is being given to creating one which includes the "distribution" .dist data files from the iproute2 source Package.

Use of netem does however require installation of the tc.lrp Package, for the tc command, and deployment of a Bridge requires bridge.lrp.

Kernel Module

Use of netem requires that kernel module file sch_netem.ko is available in directory /lib/modules/. This file should be extracted from modules.tgz (its full path within that tar archive is kernel/net/sched/sch_netem.ko).

To be continued...

Prev Up Next