Basic QoS Configuration

Quality of Service is a powerful means of ensuring that important traffic, such as voice or video, is prioritized over less important traffic like file downloads. However, configuring it can be quite complicated so this guide aims to help beginners get a basic config up and running.

Step-by-step guide

  1. The first step to configuring QoS is to determine how you want to split up the traffic being emitted from a port, and what the relative priorities of that traffic are. For our example, we want to ensure that traffic with a high DSCP value destined for the 10.10.10.0/24 subnet is given priority over everything else. This will require us to

    1. define a class to match this traffic,

    2. to map packets with certain DSCP values to a specific queue,

    3. to associate that queue with the highest priority traffic class and

    4. to give that traffic class a bigger share of the available bandwidth.

  2. First, we need to create the shell of our policy. Every policy requires a default profile to be configured, in order to know what to do with traffic that doesn't match any of the classes we define in the policy. However, we can just define an empty profile to begin with and make changes later if we feel it's necessary.
    Here we create a qos policy called example, create a basic profile called default and set it as the default profile of the policy:

    vyatta@vm-84-1# edit policy qos name example shaper [edit policy qos name example shaper] vyatta@vm-84-1# set profile default [edit policy qos name example shaper] vyatta@vm-84-1# set default default [edit policy qos name example shaper] vyatta@vm-84-1# commit [edit policy qos name example shaper] vyatta@vm-84-1# top [edit] vyatta@vm-84-1# show policy qos name example name example { shaper { default default profile default } }
  3. The next step is to define a class which will match the traffic we are interested in prioritizing. It's possible to define many match rules for a class, but in our case, we only need one that matches on the destination subnet 10.10.10.0/24.

    vyatta@vm-84-1# edit policy qos name example shaper [edit policy qos name example shaper] vyatta@vm-84-1# edit class 1 match dest_subnet [edit policy qos name example shaper class 1 match dest_subnet] vyatta@vm-84-1# set destination address 10.10.10.0/24 [edit policy qos name example shaper class 1 match dest_subnet] vyatta@vm-84-1# show +match dest_subnet { + destination { + address 10.10.10.0/24 + } +} [edit policy qos name example shaper class 1 match dest_subnet]
  4. Now we can set up the profile for this class, starting with a map to identify packets within a high priority DSCP range and map them to a specific queue.

    vyatta@vm-84-1# up [edit policy qos name example shaper class 1] vyatta@vm-84-1# set profile high_dscp_prio [edit policy qos name example shaper class 1] vyatta@vm-84-1# up [edit policy qos name example shaper] vyatta@vm-84-1# edit profile high_dscp_prio [edit policy qos name example shaper profile high_dscp_prio] vyatta@vm-84-1# set map dscp 48-63 to 2 [edit policy qos name example shaper profile high_dscp_prio] vyatta@vm-84-1# show +profile high_dscp_prio { + map { + dscp 48-63 { + to 2 + } + } +}
  5. Queue 2 now needs to be associated with traffic class 0, and the share of the bandwidth in that traffic class increased to 50% of the available bandwidth. We can then commit this and test it out.

  6. Finally, while we are now prioritizing this traffic, we are not guaranteeing that our 10.10.10.0/24 subnet will get sufficient bandwidth. If there is a lot of traffic destined for other subnets, the available bandwidth will be split between our class and the default profile. Our high DSCP packets will still be prioritized relative to other traffic on this subnet, but not to traffic in the default profile. To ensure this subnet gets most of the available bandwidth we can configure it explicitly: