floppyfw
voip

Archival page … no longer updated.

How to for Wondershaper and VoIP

  • The goal of this how to is optimal interactive response time, VoIP voice quality and bandwidth use. Wondershaper with VoIP traffic shaping and outgoing queue management on floppyfw can do this.
  • What you will need

  • Wondershaper with VoIP is fully supported in the latest floppyfw-3.0.xx stable release and in all previous 3.0.x releases.
  • A VoIP service from the countless ones available. For some choices, see: voipreview.org.
  • A broadband or dsl connection provides sufficient throughput for VoIP telephony.
  • Geek factor is essential for this project. NOT for the proverbial "deer in the headlights of technology."
  • Configuration Procedure

  • Lets begin with the premise that you have a floppyfw router-firewall box that provides your home, or small office network, access to the internet.
  • In this example, a Uniden 2.4GHz cordless phone is connected using a Yealink usb-b2k adapter which plugs into a usb port on the "myhost3" pc which is running Skype software and Skypemate as shown in my Home Network Diagram.
  • A thorough, printable overview of the floppyfw config file VoIP variables is shown in:
    "floppyfw wondershaper VoIP settings matrix" (pdf format).
  • The section of the config file on floppyfw that you'll need to edit follows. The values for LO_RTPPORTS, HI_RTPPORTS and INTPORTS in this example are what I use for Skype VoIP.
#=============================================================================
#
# Wonder shaper. http://lartc.org/wondershaper/
# 
# Set this to "y" if you want wonder shaper to run at startup.
WONDER_SHAPER=y

# This requires you to set the download and upload speed. 

# The speed you are receiving data (downlink), in Kbit:
DOWNLOAD_SPEED=8192

# The speed you are sending data (uplink), in Kbit:
UPLOAD_SPEED=512

#====================================
#
# VoIP Subsection of Wonder shaper (Disabled if WONDER_SHAPER=n)
#
# If you have a IP-Phone, set this to the IP address of the phone
# or the machine running the phone software and Wondershaper will be
# even better. If left blank will remove the VoIP RT10 Class completely.
PHONE_IP=10.42.42.5

# PHONE_IP VoIP Class 10 RTP data - set to desired rate (90000 recommended)
# If left blank will remove the VoIP RT10 Class completely.
RT10=90000

# To forward RTP or SIP ports, set the appropriate FORWARD_XXX=y
# Note that forwarding udp ports will have security implications.
# VOIP rtp data ports - LOwest and HIghest port number in range 
# get from your VoIP provider Skype ports I use shown below
LO_RTPPORT=15403
HI_RTPPORT=15403
FORWARD_RTP=n

# INT - SIP priority ports - space separated if > 1
# get from your VoIP provider - normally "5060" or "5060 5061"
INTPORTS=""
FORWARD_SIP=n

#
#=============================================================================
#
  • The DOWNLOAD_SPEED value should be whatever yours measures using Kilo-bits per second (kbit). The example above shows 8192 (kbit) or 8.0 Mega-bits per second.
  • The UPLOAD_SPEED value should be whatever yours measures using Kilo-bits per second (kbit). The example above shows 512 (kbit) or 512 Kilo-bits per second. The above example is of an asymmetric connection where the ISP limits the upload bit rate.
  • The RT10 value should be left at the default value of 90000 bits-per-second (bps) for optimum outgoing voice quality BUT it may be set lower if you want to experiment and conserve some upload bandwidth with a modest reduction in voice quality.
  • Set the PHONE_IP to your ATA or IP Phones IP address. This may have to be set manually by you (as it was in my case) on the pc I plugged my usb-b2k adapter into. This is also the pc my Skype and Skypemate software runs on.
  • The ports in this example are for my Skype VoIP setup and they will be different depending on your provider or IP phone. Note that Skype does not use SIP and uses a proprietary method for establishing the connection.
  • Please note that any packet traffic over the port numbers you set in the following config variables will be placed in VoIP class 10 for "express delivery": LO_RTPPORT, HI_RTPPORT and INTPORTS (which takes space separated port number values).
  • In my config example above, the Skype port could have been put in either the INTPORTS="15403" variable, -OR- as it is shown in the LO_RTPPORT and HI_RTPPORT variables, and packet traffic over those ports would still get VoIP class 10 priority and "express delivery".
  • Some good resources to find out what ports you need to get into the VoIP class 10 category are first from your provider and secondly from the sites I've listed links for under Info/Resources below.
  • Another useful tool for determining port usage in Windows™ is TCPView. For Linux, the netstat command works pretty well too.
  • If you have made all the settings shown in red above, you should have all that you need to implement the Wondershaper AND VoIP configuration for improved VoIP telephony. If you are using Wondershaper ONLY, BE SURE to leave the PHONE_IP= entry blank and it will disable the VoIP class in wondershaper for a slight increase in upload bandwidth.
  • Always try your setup with the variables "FORWARD_RTP=n" and "FORWARD_SIP=n" first (the config default), regardless of the providers recommendation. I found that it was NOT necessary to forward any ports. If you are troubleshooting a connection problem, try only forwarding the SIP port first, then the RTP ports second, but only if SIP port forwarding does not fix the problem.
  • If or when you change the config forwarding vars "on the fly" with vi or e3 or some other editor, you must remember to re-initialize the firewall for the changes to take effect by running firewall.init.
    Type ". /etc/firewall.init" at a floppyfw console prompt to do this (without the quotes).
  • •• WARNING •• Forwarding the udp ports used in VoIP telephony on your floppyfw box, although not priviledged ports, does increase your vulnerability to internet attack vectors. The good news is that they are, for the most part, not on any frequently probed ports lists that are currently circulating. My recommendation is: Do NOT forward any ports unless you absolutely must for VoIP to function.

wondershaper and iproute2 console commands quick reference

wshaper.htb status		a detailed snapshot of qdiscs and classes status
wshaper.htb stop		stops wondershaper, purges qdiscs and zero's counters
wshaper.htb			restarts/reinits wondershaper - don't forget!
wshaper.htb nocop		starts wondershaper with ingress policer OFF **

** The nocop argument maximizes downlink speed

ip link list			tc-s qdisc ls dev eth0
ip address show			tc-s class show dev eth0
ip route show			tc-s -d qdisc
ip neigh show			tc-s -d class show dev eth0
ip rule list			[
ip route list table local	[ can also use with eth1
ip route list table main	[

Some useful references:
floppyfw
How to tweak Wondershaper

Updated: 03-Jan-2012