Product Overview » cFosSpeed » cFosSpeed Documentation, DiffServ/DSCP tagging to label traffic

How to use DiffServ/DSCP tagging to label traffic

Differentiated Services (DiffServ) is a Quality of Service (QoS) architecture. Usually, it is supported in closed domains ("DiffServ clouds") like an organisation or a LAN. With DiffServ you can label each packet with a certain value (called Differentiated Services Code Point, DSCP) and that value is stored inside of the packet. So at the next hop of the packet, the value can be read and taken into account for further routing.

cfosSpeed supports for incoming packets (you can filter on the DSCP value) and on outgoing packets (you can set the DSCP value).

DiffServ labelling is useful in several scenarios:

  1. You have multiple machines that access the Internet and you use a router (boxed or Windows machine) to provide the connectivity to the Internet.
  2. You are part of an organisation that uses in-house DiffServ to divide its traffic into several classes.
  3. You use Windows for your desktop, but a Linux box for routing.

One problem with priorisation is that when you want to decide if a packet is to be prioritised or not you don't have enough data, enough time, computational power or memory to do so. Routers are often small, very constrained embedded systems with few resources. But even if you use a full-grown Windows or Linux machine as a router some information about the data (like which program it was sent from) is already lost, since that information is not transmitted over the network.

So it is a good idea to label your packets at the origin and you can use cfosSpeed's possibilities to accomplish that efficiently and very fine-grained (filter for programs, protocols, ports or manual filter expressions).

Here is how you do it. We assume that you have a Windows desktop whose traffic you want to prioritise (the "client") and you have a router that routes your traffic (maybe among other traffic) to the Internet. Hopefully, that other traffic is also DS-labelled.

On your client you use cfosSpeed like everybody uses it and set up protocols, programs, etc. Furthermore, you set up some DSCP values. To do that click Start, programs, cfosSpeed, open console and enter "spd class": you will see a listing of the traffic classes, like this:


    class highest -prio 100 -weight 400
    class higher -prio 90 -speed 40%,0 -weight 400
    class high -prio 80 -speed 40%,0 -weight 400
    class default -weight 100
    class low -prio 0 -speed 25%,-10 -weight 25
    class lowest -prio 0 -speed 25%,-30 -weight 6
    class drop
    

For each class you can set the DSCP value by the command "spd class C -dscp X" (sans quotes), where "C" is the class name and "X" is the DSCP value which is in the range of 0 and 63. The values are arbitrary, but 0 means "no DSCP set". Other values might be in use in your organisation, ask your net admin. Make sure that class "highest" is sent out the fastest on your router and class "higher" still faster that "high".

After you have set all the class values, a "spd class" might look like this:


    class highest -prio 100 -dscp 1 -weight 400
    class higher -prio 90 -speed 40%,0 -dscp 2 -weight 400
    class high -prio 80 -speed 40%,0 -dscp 3 -weight 400
    class default -dscp 4 -weight 100
    class low -prio 0 -speed 25%,-10 -dscp 5 -weight 25
    class lowest -prio 0 -speed 25%,-30 -dscp 6 -weight 6
    class drop
    

Now we have to switch off the traffic shaping on the client. Enter "spd set fixed 1;set txspeed 2g". This will set the send speed to almost infinite, so no packets are queued locally.

On your router you can use the DSCP values to put the packets into the corresponding traffic class. Assuming the router uses cfosSpeed, you have to modify the filter settings to make use of the client's DSCP values. Again (now on the router) click Start, programs, cfosSpeed, open console and enter "spd filter". You will see a listing of all filter rules. It will contain some lines like this:

18 rt-  -highest -c highest
19 rt-  -higher -c higher
20 rt-  -high -c high

Assuming the -highest filter is the first non-firewall filter and has number 18, enter the following commands:



    spd filter -I 18 -dscp 1 -c highest
    spd filter -I 19 -dscp 2 -c higher
    spd filter -I 20 -dscp 3 -c high
    spd filter -I 21 -dscp 4 -c default
    spd filter -I 22 -dscp 5 -c low
    spd filter -I 23 -dscp 6 -c lowest
    

This will sort all packets with DSCP values into the corresponding traffic queues on the router.

If you use some other system that Windows/cfosSpeed you have to find out how to use the DSCP value for routing. Under Linux iptables might be able to do that.

That's it! All cfosSpeed settings made have been automatically saved and are active right away.

Additional comments:

DSCP tagging can be useful for load balancing as well. If you own a router that can utilise more than one Internet line at the same time, it might have a way to split the traffic on the various lines. A good solution might be to do DSCP tagging of traffic with cFosSpeed on the machine where the traffic originates and for the router to use the DSCP tags to send the traffic to one of the multiple lines to the Internet.

Links:

RFC 2474—Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers

RFC 2475—An Architecture for Differentiated Services

Wikipedia:Differentiated_services

 

Powered by cFos Personal Net Web Server
Practice random kindness and senseless acts of beauty