6 July 2007 @ 9:57Slow down with ipfw
Too many people forwarding stupid emails about how to make money by forwarding this email to everyone in their address book…
Too many people surfing youtube for latest video of some idiot singing…
These sorts of things ruin the whole web experience for people who really need it for something useful. Why not slow down their connection in order to speed others up? They can wait a couple extra minutes for their videos and emails to load, right?
Here’s where ipfw with dummynet comes in. I have edited the root crontab of the workstations that I want to slow down as follows:
@reboot /sbin/ipfw pipe 1 config bw 10KByte/s; /sbin/ipfw queue 1 config pipe 1 weight 50; /sbin/ipfw queue 2 config pipe 1 weight 50; /sbin/ipfw add queue 1 tcp from any http to me; /sbin/ipfw add queue 2 tcp from me to any http; /sbin/ipfw pipe 2 config bw 50Kbit/s; /sbin/ipfw queue 3 config pipe 2 weight 50; /sbin/ipfw queue 4 config pipe 2 weight 50; /sbin/ipfw add queue 3 tcp from me to any 25; /sbin/ipfw add queue 4 tcp from any 110 to me
0 20 1,8,15,22,29 * * /sbin/ipfw -f flush; /usr/sbin/softwareupdate -a -i
0 23 1,8,15,22,29 * * /sbin/shutdown -r now
As you can see, the rules are flushed right before a software update is performed, hence enabling swift download of important things.