Using dummynet to
Simulate a Low-bandwidth Network Connection
over Two Ethernet Interfaces
by Marion Bates <mbates at whoopis.com>
This document describes using dummynet run from a bootable BSD floppy to create a router between two clients, for purposes of simulating bandwidth/latency restrictions between two points.
- Download the PicoBSD floppy disk image from http://info.iet.unipi.it/~luigi/ip_dummynet/ (scroll down to the bottom for the download link.)
- Make a floppy:
dd if=pico.000608.bin of=/dev/floppy-fd0 bs=512
Note that your floppy device name/location may differ; the command above worked on a stock Fedora Core 5 machine.
- Get a server and install a pair of common ethernet PCI cards. We used SMC EZ Card 10/100 PCI; the drivers included on the floppy definitely support those.
- Boot from the floppy. Ignore the prompt for hostname/ip, you'll do it later. Log in as per the instructions displayed at the prompt.
- Run these commands:
ifconfig rl0 inet 10.0.0.1 netmask 255.255.255.0
ifconfig rl1 inet 10.0.0.2 netmask 255.255.255.1
Note that they have to have different subnet masks or ioctl whines. Don't worry, you will "tie them together" in a minute.
- Next, run these commands:
sysctl -w net.link.ether.bridge=1
sysctl -w net.link.ether.bridge_ipfw=1
- Now, connect two client machines, one to each of the two network interfaces, using a crossover cable in each case. Assign each client an IP address in the 10.0.0.x range, where x is greater than 2, and using netmask 255.255.255.0 for each. No gateway specification or DNS info is necessary. Make sure that each client can ping the other.
- Now, you can start screwing around with the actual traffic. For example, to throttle all IP traffic to 50 kilobits per second with a 1-second latency delay, do:
ipfw add pipe 1 ip from any to any
ipfw pipe 1 config bw 50Kbit/s queue 10 delay 1000ms
Refer to http://info.iet.unipi.it/~luigi/ip_dummynet/ for much more detailed information about ipfw usage, etc.