Jun 19 2008

Using Primus and BitTorrent at the same time

Published by Jonathan Wise under Articles, Hacks

I’ve scoured the Internets and not found any best practices or recommendations for how to set-up hardware VoIP, like what’s offered by Primus in Canada, so that call quality is not affected by BitTorrent (or other bandwidth-heavy activity.) So documented here is the configuration I’ve found to work best.

But first, here’s how I originally had it set-up…

Initially I connected the Linksys VoIP gateway box that Primus sent me to my router (a Linksys WRT160N) figuring I could use its QoS to make sure that voice calls were given priority. I tried all of the QoS configuration methods available to ensure that the gateway was the highest priority device on my network: I set its MAC address and its physical port to “High” while everything else in QoS, especially the TCP ports being used by BitTorrent on both my computers were set to “Low.”

Frankly, this wasn’t enough. I constantly was connected to wrong numbers when I dialed out, and when I was able to connect, calls would be plagued by static and lag until I shut down the BitTorrent clients on both computers — and this was even when they both had significant “speed limits” enforced to ensure that neither was consuming more than 10kbps up or down.

I was more than a little frustrated. I pay $100 a month for business DSL, that promises 6mbps down (actually delivering around 5) and 800kbps up (actually delivering around 350.) Sure my DSL provider sucks, but thats another story. It should have been sufficient to download a total of 20kbps while still talking on the phone.

The problem, it turns out, was in Linksys’ QoS implementation. Its just not that good. The custom firmware available for the WRT54G series routers (plug for Tomato!) has much better QoS, and if I was willing to downgrade my hardware back to that venerable but older device, maybe I would have had better luck. But the WRT160N is a darn fast router, and I’m otherwise quite happy with it.

So here’s how I got things working — and suprisingly, it required following the advice of the Primus tech support guys… and then going just a little bit further. Who woulda thought a company’s tech support department actually knew what they were talking about?!

First of all, just do what they suggest, and put the gateway between your modem and your router. I know having another hardware device between the internet and your network probably rubs you the wrong way, but it’s OK, I promise! Connect your modem to your VoIP gateway, and your VoIP gateway to your router.

  • If you’re using DSL, you’ll need to provide your gateway with your PPPoE login info. This requires temporarily connecting my PC to the gateway’s Ethernet port, and then directing my browser to 192.168.0.1
  • If you’re using the Linksys SPA hardware gateway, when asked for authentication provide a username of “user” and a password of “primus” (for any other device, call Primus to find out the login information — don’t worry, they’ll give it to you.)
  • Now go into the WAN tab, and provide your PPPoE login info.
  • Reconnect the Ethernet port on your gateway to your router, connect your PC back to your router, and configure your router’s Internet connection for DHCP (if it isn’t already)
  • Find the Internet MAC address on your router (probably in the Status tab) and copy it.
  • Now return to the gateway config page (still 192.168.0.1) and go to “Advanced” (again, this is for the Linksys box, your settings may vary)
  • Under LAN set-up, add a DHCP reservation for your router, using the MAC address we looked up before, to make sure it always gets the same IP.
  • Now the final, most important step, is to DMZ your router. In the “Application” tab is a section where you specify the IP address of the device you want DMZed. Use the IP you reserved in the step above.

Save all your settings, and return to your router config pages. Now you can specify QoS for everything else inside your network. The VoIP gateway will make sure calls get priority over the DMZ device, but otherwise forwards everything right through to the router, which will make sure that everything else is QoSed the way you want it.

(Important side-note: If you don’t have a router, don’t DMZ your PC! This is never a good idea! The only reason DMZ is OK here, is because we have another hardware device protecting the internal network, and doing the port forwarding, etc…)

Using this configuration I can leave BitTorrent running all day, and still have great voice quality on my phone calls. I do still need to set a speed limit on my BitTorrent clients, which I have enforced during business hours (Transmission on the Mac has a “Speed Limit” option, uTorrent has a “Scheduler” — both allow you to constrain torrent activity during certain times) but not nearly as heavily as I had before.

Now that I have much less bandwidth available to me (down from 13MBPS on RoadRunner in New York) I’ve had to reverse the QoS policies I had articulated before so that Torrents are the lowest priority activity on my network. Skype is the highest priority, and HTTP/IMAP/SMTP traffic are in the middle. This keeps the web and e-mail moving quickly. Again, the VoIP Gateway, since its the first level traffic cop, makes sure than nothing is more important than voice calls.

Primus’ customer service isn’t much help, and tech support will give up on you fast if you seem to have a slow Internet connection. On the other hand, they seem to know that they have somewhat niche technology typically adopted by the more savvy, and assuming your connection is OK, they’re pretty willing to give you whatever advanced information you want to try and tweak your settings yourself…

Plus you can’t really beat their long distance prices, or that killer “Concierge” feature on the Portal page…

2 responses so far

Nov 18 2007

Tomato QoS on a Linksys WRT-54G v.2

Published by Jonathan Wise under Articles

Kudos to anyone who creates their own Linux based firmware and turns a $40 consumer router, into a high-end piece of kit. Truly, they all are awesome achievements. But I’ve got to say, DDR-WRT has nothing on the Tomato firmware. After hearing how happy SuperJason was with his flashed firmware, I decided to take the plunge myself and re-flash my router.

I’d first flashed my box over a year ago to the DDR-WRT firmware and was impressed, but it definitely had a few bugs. I wanted it for DHCP reservations and QoS. DHCP reservations worked, but internal name resolution did not. And the QoS implementation made my network flaky. Tomato changed everything.

First of all, the UI isn’t as nice as DDR-WRT — which does its best to duplicate the Linksys firmware. Tomato’s is a little uglier and a lot harder to find things until you get used to it. But its so much more powerful. After reading around the Internet, I think I’ve finally settled on these QoS classifications…

A note to newbs, before I launch into my explanation: make sure you turn off “Prioritize ACK” so that you don’t get flooded with BitTorrent ACK requests.

As you can see here, I place high priority on BitTorrent traffic. That’s because it drives our TV watching. Each of the things that gets higher priority than torrent downloading has a good reason:

DNS - Normal DNS requests are tiny and should get handled right away — even if the webpage itself loads slower, you don’t want to be hanging during name resolution wondering if your Internet is down.

SMTP - Outgoing mail should go when I hit send. Maybe this is odd of me, but I like hearing the “swoosh” sound in Mail.app as soon as I hit the button.

FTP - I rarely use FTP any more, unless I’m working on a website or uploading something important. On the occasion that I do need it, I want it out of the way as fast as possible.

VNC - If I need VNC its because I’m helping someone else with their computer, or I’m connecting into mine to troubleshoot a problem. In either case, I don’t want to wait for screen refreshes.

On par with BitTorrent traffic are small HTTP requests — loading the Google homepage, or even Digg, comes in at less than 50kb, so lets just get it out of the way.

Large HTTP requests — for a download, or streaming some Flash, can frankly wait a few seconds longer. Similarly, receiving mail isn’t that urgent — it only gets checked every 15 minutes, so if it takes 16 minutes instead, who’s going to notice?

Below this is essentially everything else. If a website isn’t tight enough to get in under 50kb, but not big enough that it might be interesting enough to warrant the higher priority, it gets tucked in with bulk traffic.

The effect is immediate when you turn QoS on. My WordPress admin page, with its IFrames, takes a little bit longer to load, but never looks like its hung. My homepage and Digg come up instantly. And none of our normal use has any significant impact on my BitTorrent downloads. I’m relatively new at this QoS stuff, but having watched the Chart view and studied the Detail view, I think I’ve already learned a lot. Any suggestions from anyone with more experience?

9 responses so far