dummynet

Contents

Disclaimer: I have no experience with dummynet or PicoBSD, and almost no experience with FreeBSD. My goal is to document the creation of a PicoBSD floppy image with dummynet and a custom kernel (with shorter time slices) in QEMU in order to replicate TCP experiments. [FreeBSD in QEMU] and [building PicoBSD] are orthogonal tasks, but I'll pile both in this page.

  1. FreeBSD + PicoBSD
    1. The FreeBSD setup
    2. The PicoBSD setup
  2. Freezy FreeBSD Live CD + dummynet
  3. Take 3: Custom FreeBSD Kernel
Important links

The FreeBSD setup

My principal machine is a Linux desktop, so my first goal is to install FreeBSD 4.3 in a QEMU VM:

  1. Create the QEMU image: `qemu-img create freebsd43.img 30G`
  2. Startup the FreeBSD installer and install a system with full sources: `qemu -cdrom 4.3-install.iso -hda freebsd43.img -boot d`
  3. After installing, restart QEMU without the install cd: `qemu -hda freebsd43.img -net nic -net tap`
In retrospect, FreeBSD installed like a charm, and this step actually turned out to be less painful than expected.

The PicoBSD setup

Now on to making a PicoBSD image. I'm following directions from Tentative PicoBSD FAQ. The bridge reference configuration comes with ipfw and dummynet, so *crosses fingers* it should suffice.

  1. I created a /usr/local/sbin and copied /usr/src/release/picobsd/build/picobsd into there.
  2. Now, just running `picobsd router` in a clean directory gives a problem with `more`. I edited crunch.conf in the bridge directory:
    --- /usr/src/release/picobsd/bridge/crunch.conf.orig    Thu Apr 27 04:06:13 2006
    +++ /usr/src/release/picobsd/bridge/crunch.conf Thu Apr 27 05:44:24 2006
    @@ -87,7 +87,7 @@
     #progs less # 36KB
     #ln less more
     progs more # 12KB
    -special more srcdir /usr/ports/picobsd/more
    +special more srcdir /usr/ports/misc/44bsd-more
    
     progs sysctl
     progs swapon # 0KB.
    @@ -152,15 +152,15 @@
     progs inetd # 12KB.
     progs telnet # 20KB.
     progs telnetd # 12KB.
    -#progs ftp # 28KB.
    -#progs tar # 32KB.
    +progs ftp # 28KB.
    +progs tar # 32KB.
    
     # Check the ssh license! If you want to use this,
     # go to /usr/ports/security/ssh-picobsd, do a make extract configure
     #progs sshd    # includes ssh and scp
    -special sshd objvar SSHD_OBJS
    -special sshd srcdir /usr/ports/picobsd/ssh-picobsd/work/ssh-1.2.27
    -special sshd objdir /usr/ports/picobsd/ssh-picobsd/work/ssh-1.2.27
    +#special sshd objvar SSHD_OBJS
    +#special sshd srcdir /usr/ports/picobsd/ssh-picobsd/work/ssh-1.2.27
    +#special sshd objdir /usr/ports/picobsd/ssh-picobsd/work/ssh-1.2.27
    
     ### ee uses ncurses instead of curses
     libs -ledit -lutil -lmd -lcrypt -lmp -lgmp -lm -lkvm
    
    
  3. I ran `picobsd bridge` in a clean directory and changed the MFS to 10000kB to make space for log data.

Frenzy FreeBSD Live CD + dummynet

Frenzy is a FreeBSD Live CD that has the dummynet kernel module and iperf in the standard distribution. It's perfect!

ifconfig vr0 up
dhclient
kdload dummynet
If iperf crashes on FreeBSD with a pthread error, try running each iperf server in interactive (non-daemon, non-background) mode, each instance under a different user. (It works!)

Take 3: Custom FreeBSD Kernel

Kernel built with these options



Thomas Kho <tom@tkho.net>
Last Updated: June 22, 2006