Here’s a quick note/tutorial about how to setup FreeBSD 7.0 as a network bridge and use dummynet to shape the traffic, There is a pretty good tutorial on the net but I found it’s rather outdated. So here is mine.
First of all we’ll need to setup FreeBSD as a network bridge.
This should return “bridge0″ if this is the first bridge you created.
And we’ll add the two interface used on the bridge. It’s “rl0″ and “vr0″ in my case:
Now bring the bridge up. Note the two interface need to be up too.
ifconfig vr0 up
ifconfig bridge0 up
If you want an IP address of the box, assign it to the bridge
Now the bridge should work. To make dummynet work, we’ll need to recompile the kernel:
add
options IPFIREWALL_DEFAULT_TO_ACCEPT
options DUMMYNET
options HZ=1000
to the kernel config file and rebuild it. Then add
firewall_type="open"
to /etc/rc.conf.
Make sure you have filewall_type=”open” in /etc/rc.conf and/or options IPFIREWALL_DEFAULT_TO_ACCEPT in your kernel config file before you do the reboot if you are doing this remotely. Or you’ll block yourself out.
Now enable ifpw on the bridge
OK, we can now add a pipe:
Note the “1000″ in the command line. Do a
first and choose a good place for the pipe.
Now it’s time to shape the traffic. To add some delay:
or add some package lost:
Reference:
The FreeBSD hand book about bridging
The FreeBSD hand book about IPFW
Comments 5
Great little post Dryice.
Posted 06 Mar 2009 at 9:08 pm ¶Thanks a lot!
Wow.. if only i found this earlier.. took me the whole day to figure this out and then i saw your page..
Posted 24 Apr 2009 at 9:25 am ¶It was a great help, it took me almost a week to find the solution, always thank’s to you.
Posted 02 Jul 2009 at 7:50 am ¶thanks ! do you have QQ or Msn I sew your page but I have some problom . Can I ask you ? I am a chinese
Posted 06 Nov 2009 at 12:33 pm ¶my QQ: 475332295
Posted 06 Nov 2009 at 12:47 pm ¶Msn: sooetechnic@hotmail.com
Post a Comment
You could use <code type="name"> to get your code colorized