Shaping Traffic

Speaking of (automobile) traffic, there isn’t a whole lot of it out in my section of Kennesaw. But there’s plenty of other traffic. Driving home the other day I noticed the neighbor up the street had won the “Yard of the Month” award. Uh oh, I thought. Sure enough, the next day the deer were over there eating the flowers. When you approach them, they give you one of those bored looks, “Yeah, you talkin’ to me?”. This time, though, they had Bambi with them, a little fawn with white spots. Very cute; I hadn’t seen Bambi before. I like the deer, but my other neighbor, Andrew, thinks we ought to be able to shoot them if they stray onto our property. Like most of my neighbors, Andrew is a good Republican and values his property and firmly believes that flowers shouldn’t be eaten. Just to check, though, he asked our friendly neighborhood policeman.

Let me get this straight, here in Kennesaw we’re required to own and maintain at least one firearm in our home?

Yessir, that’s the law.

But should we actually fire that firearm, say at a marauding pest, say at a deer eating my flowers on my own property, not across the street, but on my own property, I’d be arrested?

Yessir, and you’d be facing multiple felonies. Discharging a firearm within city limits and reckless endangerment to name two. And I’d personally take you to the the station cuffed and chained like a rat with great pleasure.

Hmmm… it would appear that I’m veering off topic.

The actual traffic I was thinking of is little bits of data streaming in and out of my home. Little packets of stuff, syn/ack packets,etc. all come rushing into my DSL modem at a supposed 3.0 mbits per second and other traffic goes rushing out, but at a much slower speed.

“I got this here little packet, part a that there, from this here guy at such-n-such an IP address. Ya want it?”
“Huh? From where? Oh okay, yeah send it in.”

The syn/ack interchange goes on thousands of times per second. During the process, a lot of those packets get bumped around, or my modem can’t respond quick enough to acknowledge a delivery because it only goes 384 kb upstream. Packets get stalled, some go back and get re-sent any number of times. A live graph showing packet arrival and departure is swinging all over the place, from 2.6 mbps down to 1.0, down to zero, up to 1.8…. It goes on, and the average rate of flow is somewhat less than I signed up for when I subscribed to 3.0 DSL (or cable internet for that matter).

Enter traffic shaping and a new router. The Linksys WRT54G wireless router doesn’t come with traffic shaping, I’ll get to that in a minute. I don’t even particularly need the wireless connectivity, so I have that disabled because it comes with a 4 port switch for a wired LAN. What’s nice about the WRT54G is that it’s built on Linux. And since this particular linux application is open source, third parties (people like us) get to mess with it.

A group of people over at Sveasoft have been developing beta and stable versions of firmware for this particular router for some time now, and they have a big forum. They’ve added all kinds of functionality to this basically cheap router geared toward the home user. Among others, they’ve added telnet, ssh, cron, dns server and something called “bandwidth management” (traffic shaping) modules for us to play with. All easily configured on the standard Linksys web interface.

Why do I care about traffic shaping/bandwidth management? Well, wanting to get rid of the two business phone lines going into my home, I subscribed to Vonage voice over IP telephone service. Basically, they send you a box that plugs into your router and you plug your phone lines into that. You get unlimited local and long distance service and all the “extras” like Caller-ID, call forwarding, etc. And it’s very cheap. Bye bye Bellsouth, right?

Well, not so fast there. I was on the phone with a client and inexplicably, the call started breaking up. I look across the room and see Elaine checking her email. Uh oh, it’s all those packets colliding and bouncing and getting resent again. Not real pretty on a business phone line.

The bandwidth management function on the new router allows me to set the Vonage box as “high priority” and everything else as “low priority”. That means that instead of the packets bouncing around all over the place when I’m trying to make a phone call, the phone call packets go through smoothly, and the other low priority packets, like checking email, wait in line patiently. Do they stop altogether? Nah, Elaine doesn’t even notice that her email is downloading a few split seconds slower. And my phone calls no longer break up.

But wait, there’s more. By turning on traffic shaping at the WAN gateway, all the packets are coming in in a lot more orderly fashion. Suddenly my throughput is more like I signed up for when I subscribed to 3.0 mbps DSL. Check out this graph from a 64 meg download.

Traffic be shaped

2.6 mbps average throughput? Dang! I need to go interest Andrew in a new hobby.