DUMMYNET

Dummynet is a FreeBSD tool that was created by Dr. Rizzo (see his link on the left), and it was originally designed for testing network protocols. However its powerful bandwidth management functionality has made it one of the most popular WAN simulators. It allows you to simulate different queueing mechanisms; bandwidth limitation; latency; and patcket-loss rate.

Here I am going to illustrate step-by-step how to build a bridge mode Dummynet system on FreeBSD 6.0. Please keep in mind even in bridge mode you can still assign IP address to one of the ethernet interfaces and use it as a regular workstation.

1. Enable Bridging

Add the following lines in /etc/rc.conf file:

cloned_interfaces="bridge0"
ifconfig_bridge0="addm if1 addm if2 up"
ifconfig_if1="up"
ifconfig_if2="up"
ifconfig_if1="inet x.x.x.x netmask x.x.x.x"

Replace if1 and if2 with the real names of your network interfaces and x.x.x.x with the real IP address and sunet mask. This will automatically load the bridge driver into the kernel after reboot.

2. Enable Kernel Support for DUMMYNET

You can keep the original kernel, and simply modify the /boot/loader.conf file:

dummynet_load="YES"

3. Enable IPFW

Add the follwing lines in /etc/rc.conf file:

firewall_enable="YES"
firewall_type="open"

Add the following line in /etc/sysctl.conf file:

net.link.bridge.ipfw=1

After this is done, reboot the system.

4. Configure A Simulated WAN Pipe

After rebooting the system, you can create a ipfw pipe to simulate the WAN circuit.

To create a new ipfw pipe, issue:

ipfw *** add pipe 1 ip from any to any

You need to put this before the default allow any rule.

To simulate a a 50 millisecond RTT (25 ms delay each way), issue:

ipfw pipe 1 config delay 25ms

To simulate a random 10% packet loss, issue:

ipfw pipe 1 config delay 0ms plr 0.05

To simulate a 1536Kbit/sec symmetric bandwidth pipe with 40 millisecond RTT and 0.1% random loss, issue:

ipfw pipe 1 config delay 20ms plr 0.0005 bw 1536Kbit/s


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?