I recently purchased a Cisco SG 200-26 gigabit switch to upgrade the office infrastructure. This is a “lightly-managed” switch with a web interface. Here’s what I’ve learned so far about setting up basic Quality of Service (QoS) for Voice over IP (VoIP).
First, this is a small business environment with a simple router. Since there is no VLAN-aware router or Layer 3 switch, we won’t use a separate VLAN for VoIP traffic (since there would be no way for the traffic to jump from the Voice VLAN to the main VLAN and out onto the Internet). Instead, we have two goals:
- Get VoIP traffic coming from two endpoints tagged with QoS headers. The endpoints are a SIP phone (Polycom IP 430) and an Analog Terminal Adapter (Cisco/Linksys SPA3102).
- Get the switch to prioritize that VoIP traffic ahead of other traffic.
At this point, the router and the ISP do not support QoS, so we’re really only concerned with traffic inside the office. However packets leaving the switch for the router should remain tagged in case the router and ISP eventually support QoS.
Checking the Default Headers
We’ll use Wireshark to check the headers for DSCP tags. (This MSDN article explains why you can’t see Class of Service/802.1p tags in Wireshark very easily.)
To be able to see the packets in Wireshark, use the switch to mirror a port. My phone is on port g17 and my PC is on port g1, so under Administration > Diagnostics > Port and VLAN Mirroring, here’s how I set up the mirroring:
Note You will lose network connectivity on the destination port! To reconnect to the network (including the switch’s web management UI), plug the network cable from your PC into a different port on the switch.
With Wireshark running and the mirrored port active, from the SIP phone, make an outbound call (e.g. check your voicemail). Hang up, stop Wireshark, and review an outbound RTP packet. In the Internet Protocol section, the Differentiated Services Field should show Default (0x00):
While we’re at it, let’s check the packets coming from the ATA. Set up the appropriate port mirror and start Wireshark. Assuming you have an analog phone connected to the ATA, make an outbound call from your analog phone. Again review an outbound RTP packet:
Interesting: the SPA3102 (with firmware 5.1.10) is apparently automatically tagging packets with a DSCP value of Expedited Forwarding (0x2e = 46).
I should perhaps mention that the SPA3102 itself has a QOS Settings section in its advanced Wan Setup page. The options for QOS QDisc are NONE and TBF. As best I can tell, this only applies when the SPA3102 is used as a router, i.e. it lets you enable basic QoS prioritization for traffic passing through the SPA3102. Since I’m using the SPA3102 as an endpoint only, that doesn’t apply, so I’ve left my QOS QDisc value set to NONE.
Since the SPA3102 is already tagging packets appropriately, we only need to worry about adding those packets to traffic coming from the phone.
Setting Up the Switch
According to Cisco support, the preferred way to set up QoS for VoIP is using LLDP MED to tell endpoints how to tag the traffic. The Polycom phone does support LLDP MED, so let’s try it:
1. In the switch’s web interface, under Administration > Discovery – LLDP > LLDP MED Network Policy, define this policy:
Network Policy Number: 1
VLAN ID: 1 (the default VLAN)
VLAN Type: Tagged
User Priority: 5 (the Class of Service if using old 802.1p tagging)
DSCP Value: 46 (also called EF for Expedited Forwarding)
2. Under Administration > Discovery – LLDP > LLDP MED Port Settings, tell the switch to enable LLDP MED on the port to which the phone is attached:
Port: Port to which phone is attached
LLDP MED Status: Enable
System Log Notification: Enable
Available Optional TLVs: choose Network Policy
Available Network Policies: choose 1
Location Coordinate: blank
Location Civic Address: blank
Location ECS ELIN: blank
3. Now let’s check the Quality of Service settings. Most of these are default values. The following screen shots are from Quality of Service > General:
If desired, from this screen, you can manually assign CoS 5 to the SPA3102 port. Since the SPA312 is already assigning (at least) DSCP, I won’t bother with CoS.
Interface Settings: all enabled
CoS/802.1p: Note that CoS 5 maps to Queue 4:
DSCP to Queue: Note that DSCP 46 (EF) also maps to Queue 4:
Save your changes to the switch by clicking this link at the top of the screen:
Checking the Modified Headers
With the changes to the switch complete, reboot the phone to force it to check for LLDP MED values. Then use Wireshark again to trap an outbound RTP packet during a call:
Ta da! The phone is now tagging the packets with Expedited Forwarding (0x2e = 46).
Checking for Prioritized Packets
If everything is working, the switch should be prioritizing VoIP traffic into Queue 4. To check this, we need to count packets that are leaving the switch (after prioritization).
Go to Quality of Service > QoS Statistics > Queues Statistics and add a counter to monitor Queue 4 on an outbound port (e.g. the one going to your PBX, g10 in my case):
On the main Queue Statistics page, click Clear Counters, then set a 15-second Refresh Rate. Call your PBX from the SIP or analog phone to generate some VoIP traffic. You should see the count of Total Packets increase as the prioritized packets flow through the switch:
Only Half Done
Hooray, our switch is now prioritizing packets with DSCP 46 ahead of other traffic, and we’ve used the switch to tell the Polycom phone to add DSCP 46 to its headers (the SPA3102 was doing that already). However because we’re using an in-house PBX, that’s only half the traffic: packets coming from the PBX to the endpoints still have DSCP 0, as do packets leaving the PBX for the router. Fixing that will be the subject of the next post.
Note Remember to remove any port mirroring settings from your switch setup! (Administration > Diagnostics > Port and VLAN Mirroring)