How to set up QoS bandwidth rate limit on Vyatta router

If you are running a network shared by multiple devices, you probably want to set up QoS policies (e.g., average bandwidth rate, burst size), so that network bandwidth is properly shared by them. Vyatta software router supports powerful QoS settings. You can easily define any QoS policy, and bind the policy to a specific network interface/port, or to specific types of traffic, etc.

If you would like to set up QoS bandwidth rate limit on Vyatta, follow the instructions below.

I assume that Vyatta router has two interfaces: eth0 connected to internal LAN, and eth1 connected to external networks. Here I will set bandwidth cap for upload traffic at 1Mbits/sec and download traffic at 2Mbits/sec.

What I will do is the following. First, define outgoing traffic shaper on eth1 to rate limit outbound traffic (i.e., upload traffic), and then define another outgoing shaper on eth0 to rate limit inbound traffic (i.e., download traffic). I am going to use Vyatta's Command Line Interface (CLI) to set this up.

$ configure
[you are entering Vyatta's CLI]
$ set traffic-policy shaper UPLOAD-POLICY
$ set traffic?policy shaper UPLOAD-POLICY bandwidth 1Mbit
$ set traffic?policy shaper UPLOAD-POLICY default bandwidth 50%
$ set traffic?policy shaper UPLOAD-POLICY default ceiling 100%
$ set traffic?policy shaper UPLOAD-POLICY default burst 15k
$ set traffic?policy shaper UPLOAD-POLICY default queue-type fair-queue
$ set interfaces ethernet eth1 traffic?policy out UPLOAD-POLICY
$ set traffic-policy shaper DOWNLOAD-POLICY
$ set traffic?policy shaper DOWNLOAD-POLICY bandwidth 2Mbit
$ set traffic?policy shaper DOWNLOAD-POLICY default bandwidth 50%
$ set traffic?policy shaper DOWNLOAD-POLICY default ceiling 100%
$ set traffic?policy shaper DOWNLOAD-POLICY default burst 15k
$ set traffic?policy shaper DOWNLOAD-POLICY default queue-type fair-queue
$ set interfaces ethernet eth0 traffic?policy out DOWNLOAD-POLICY
$ commit
$ save
$ exit
[you are exiting Vyatta's CLI]

The resulting /config/config.boot looks like the following:

interfaces {
      ethernet eth0 {
            address 192.168.10.1/24
            ......
            traffic-policy {
                  out DOWNLOAD-POLICY
            }
      }
      ethernet eth1 {
            address dhcp
            ....
            traffic-policy {
                  out UPLOAD-POLICY
            }
      }
}

traffic-policy {
      shaper UPLOAD-POLICY {
            bandwidth 1Mbit
            default {
                  bandwidth 50%
                  burst 15k
                  ceiling 100%
                queue-type fair-queue
            }
      }
      shaper DOWNLOAD-POLICY {
            bandwidth 2Mbit
            default {
                  bandwidth 50%
                  burst 15k
                  ceiling 100%
                  queue-type fair-queue
            }
      }
}

Later if you want to change your bandwidth rate limit on Vyatta, you can simply do:

$ configure
$ set traffic-policy shaper DOWNLOAD-POLICY bandwidth 8Mbit
$ set traffic-policy shaper UPLOAD-POLICY bandwidth 4Mbit
$ commit
$ save
$ exit

The change will take effect upon commit. So you do not need to reboot Vyatta.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

One thought on “How to set up QoS bandwidth rate limit on Vyatta router

  1. Hi Dan, I really liked your tip!!!!

    Just to understand, could you explain me somethings? In those options:

    bandwidth 1Mbit --> what is the function of this option?
    bandwidth 50% --> what is the function of this option?
    burst 15k --> Here we are defining that the bandwidth can go across 15k?
    ceiling 100% --> Here is defining that the user can use all of bandwidth?
    queue-type fair-queue --> what is the function of this option?

    And it will apply for all connection, right? But we can configure a network, for example? 192.168.14.0/24 ?
    Thanks!

    Diego

Leave a comment

Your email address will not be published. Required fields are marked *