This is old, but I see people asking for it every now and then.
Quick Dummynet howto...
I needed to emulate a real wan connection for some testing I'm doing. This was a PITA to find out on my own, so I'm documenting everything.
This is just on a livecd right now, so you have to issue these commands every time you reboot, which sucks, but luckily it runs on BSD which, hardly ever needs to reboot.
First you'll want to grab a copy of the Frenzy Freebsd Live CD here:
http://frenzy.org.ua/en/index.shtml
After it boots, I issue these commands (note, i'm running this on a box with 3 nics, 1 for managment, 2 for the bridge) You could pull it off with just two nics as well, later I'm going to turn it into a router too, so it will do routing as well as introducing bw settings latency, loss, etc. Also on the Todo list is make a vmware image of all of this with scripts to easily change settings for the bridge/router...
For right now this is what I do to get it up and running:
#setup networking
ifconfig em0 172.16.62.11 up
route add default 172.16.62.254
ifconfig bridge create
ifconfig bridge0 addm em1 addm em2 up
ifconfig em1 up
ifconfig em2 up
#load dummynet
kldload dummynet
#ipfw commands
sysctl net.link.bridge.ipfw=1
ipfw add pipe 1 ip from any to any
ipfw pipe 1 config bw 2Mbits/s delay 30ms plr .01
ipfw list
# we need to make sure that the any to any rule with the pipe is the highest any to any rule..
ipfw delete 65000
ipfw list
# From Lucas: adds memory for network buffers
#the queue for dummynet can take a lot of memory and it behaves badly when it runs out
sysctl kern.ipc.nmbclusters=32768
#To watch traffic on the bridge, simply type
tcpdump -i bridge0
Nice, just found this to backup settings to a floppy:
http://frenzy.org.ua/en/releases/1.0/doc/doc_en-backup.html
Here are some links that I found helpful when figuring all this out:
http://info.iet.unipi.it/~luigi/ip_dummynet/
http://www.freebsd-howto.com/HOWTO/Ipfw-HOWTO
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-bridging.html
http://www.freebsd.org/cgi/man.cgi?query=if_bridge&sektion=4
Tuesday, May 11, 2010
Open Source WAN Emulation Howto
Labels:
bsd,
carp,
cloud computing,
openbsd,
qemu,
virtualization,
WAN emulation
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment