Cisco QoS
There's lots of talk about Quality of Service (QoS). It lets you adjust traffic flow to give priority to some traffic, and limit others. It's not the magical cure to network issues, that some people think it is. It's more like overdraft protection on your bank account: it's good for those little emergencies, but you do not want to depend on it. If your QoS is constantly adjusting packets to compensate for congestion or high latency, you need a better pipe.
That being said, here's how to set up a basic policy that will optimize various types of traffic.
QoS works on a two step process: classify packets then optimize their flow.
The policies like this get applied to the WAN interface of the router on each end of the connection. You need to know what the actual available bandwidth is on the link, not just what it's specified as. If you set the line rate in the policy to be higher than what the usable capacity is, the QoS policy will never kick in. With Cisco, the QoS policy is only activated during times of congestion.
A major problem with high-latency, low-bandwidth links like T1's is that small, time-sensitive VoIP packets get held up behind big data packets that take a long time to send. The solution is to break up the big packets, and interleave the voice packets. Part of the solution is to lower the IP MTU on the WAN interface of the router. Once this is done, big packets that come in to the LAN interface get broken up (fragmented) by the CPU, which mixes in the voice packets according to the priority statements in the QoS policy.
! Depending on the software revision, you can identify traffic by almost any attribute class-map match-any DSCP-VOICE-CONTROL match dscp af41 class-map match-any NETWORK-CONTROL match protocol ospf match protocol snmp match protocol icmp match protocol telnet class-map match-any DSCP-VOICE match dscp ef ! This policy takes the traffic classes and allocates bandwidth to them policy-map CLASSIFY_TRAFFIC class DSCP-VOICE ! "Priority" traffic is sent to the egress queue before all other traffic (in kbps) ! The priority is also a rate limiter, so during congestion, anything in excess of the vlaue will be dropped. ! You'll want to be sure to have this high enough that you won't cause any packet drops, but not so high that you ! wont have enough bandwidth for any other traffic classes. priority 1100 class DSCP-VOICE-CONTROL ! Bandwidth values can be in kbps or percentages of the overall bandwidth (see below) bandwidth 100 class NETWORK-CONTROL bandwidth 8 ! Any remaining bandwidth is given to any unclassified packets. ! This policy defines the overall bandwidth on the interface, as it may be less than the interface's physical bandwidth policy-map WAN_POLICY class class-default ! The total bandwidth values defined above cannot exceed the number below shape average 1300000 ! Embeds the policy above into this policy service-policy CLASSIFY_TRAFFIC ! ! ! interface FastEthernet1 description TO WAN CONNECTION ip address 10.10.10.2 255.255.255.248 ! 600 is a value that I found works generally well. ip mtu 600 ! These commands limit the number of packets that can be in the hardware transmit queue. ! This gives the CPU more control over which packets are sent over the wire first. tx-ring-limit 3 tx-queue-limit 3 ! Applies the policy to the WAN interface service-policy output WAN_POLICY !