October 23, 2014
 
 
RSSRSS feed

Giving VoIP Traffic the Green Light, Part 2 - page 2

Beginning the Configuration

  • July 5, 2006
  • By Carla Schroder

Traffic-shaping is a bit of a black art. The traditional tools, as described in the Linux Advanced Routing & Traffic Control HOWTO, require a fair bit of study. So we'll start out with Wondershaper, which is a simple utility designed to maintain low latency on busy network links. Wondershaper should be installed on your Internet gateway.

The Debian (and Debian derivatives like Ubuntu and MEPIS) version of Wondershaper is slightly different. Please follow the excellent Debian howto installed on your system at /usr/share/doc/wondershaper/README.Debian.

Wondershaper is run the same way on all other Linux distributions. Just download and unpack the tarball, and it's ready to go to work:

# tar zxvf wondershaper-1.1a.tar.gz
wondershaper-1.1a/
wondershaper-1.1a/wshaper.htb
wondershaper-1.1a/wshaper
wondershaper-1.1a/README
wondershaper-1.1a/COPYING
wondershaper-1.1a/VERSION
wondershaper-1.1a/TODO
wondershaper-1.1a/ChangeLog

There are two executable scripts, wshaper and wshaper.htb. wshaper is the one we'll use. Copy it to a directory that is in your path, like /usr/local/bin, so you can run it like any other command:

# cp wondershaper-1.1a/wshaper /usr/local/bin

Just for fun go ahead and run it:

# wshaper

Please read the documentation in README first :-)

This is good advice, but you can do that later. Let's have some fun first and establish a baseline on our Internet link. Do this by finding the next hop after your router with the route command, as this example (using fake IPs) shows:

# route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
122.166.166.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 122.166.166.1 0.0.0.0 UG 0 0 0 eth1

This illustrates a typical multi-homed Linux gateway/router. The next hop and default gateway at the ISP is 122.166.166.1. U means the route is up, and G means use this gateway. Now ping the gateway, ideally when your link is idle, to get an idea of the native latency:

$ ping -c5 122.166.166.1

PING 122.166.166.1 (122.166.166.1) 56(84) bytes of data.
64 bytes from 12.169.163.1: icmp_seq=1 ttl=255 time=17.3 ms
64 bytes from 12.169.163.1: icmp_seq=2 ttl=255 time=16.5 ms
64 bytes from 12.169.163.1: icmp_seq=3 ttl=255 time=16.0 ms
64 bytes from 12.169.163.1: icmp_seq=4 ttl=255 time=17.7 ms
64 bytes from 12.169.163.1: icmp_seq=5 ttl=255 time=17.9 ms

--- localhost.localdomain ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2998ms
rtt min/avg/max/mdev = 0.068/0.068/0.069/0.005 ms

That's some mighty fine ping times. Now start a big download, like the Asterisk@Home 2.8 .iso, and run the ping test again:

$ ping -c5 122.166.166.1
PING 122.166.166.1 (122.166.166.1) 56(84) bytes of data.
64 bytes from 12.169.163.1: icmp_seq=1 ttl=255 time=181 ms
64 bytes from 12.169.163.1: icmp_seq=2 ttl=255 time=117 ms
64 bytes from 12.169.163.1: icmp_seq=3 ttl=255 time=160 ms
64 bytes from 12.169.163.1: icmp_seq=4 ttl=255 time=168 ms
64 bytes from 12.169.163.1: icmp_seq=5 ttl=255 time=193 ms --- 122.166.166.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4003ms
rtt min/avg/max/mdev = 117.066/164.104/193.216/26.028 ms

That makes a big difference, and on an overloaded network you'll start to see packet loss as well, which is bad for VoIP performance. Keep the download going, change to root, fire up Wondershaper, and re-run ping:

$ su -
# wshaper eth1 600 200
# ping -c5 122.166.166.1
PING 122.166.166.1 (122.166.166.1) 56(84) bytes of data.
64 bytes from 12.169.163.1: icmp_seq=1 ttl=255 time=30.3 ms
64 bytes from 12.169.163.1: icmp_seq=2 ttl=255 time=36.6 ms
64 bytes from 12.169.163.1: icmp_seq=3 ttl=255 time=84.8 ms
64 bytes from 12.169.163.1: icmp_seq=4 ttl=255 time=16.5 ms
64 bytes from 12.169.163.1: icmp_seq=5 ttl=255 time=53.2 ms --- 122.166.166.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4003ms
rtt min/avg/max/mdev = 16.572/44.340/84.880/23.441 ms

That's quite an improvement. This works by a bit of magic that throttles your line speeds to a little bit under the maximum, with the result that no queuing is necessary. Queues are the enemies of latency. Traffic literally piles up until it is either delivered or discarded. Queues are everywhere--in your broadband modem, at your ISP, and everywhere upstream of you. The Wondershaper README goes into more detail on queueing.

You need to know your real bandwidth. This requires some guesstimating and tinkering. For example, my DSL line is rated at 768/256, so 600/200 seemed like a good starting point. There are a number of Web-based speed testers, like the one at DSLReports.com, which is also a great site for broadband and networking information.

Come back next week to learn how to monitor Wondershaper, start it automatically, and how to give priority specifically to Asterisk traffic.

Resources

This article originally appeared on VoIP Planet, a JupiterWeb site.

Sitemap | Contact Us