How to set up QoS bandwidth rate limit on Vyatta router

Last updated on October 31, 2012 by Dan Nanni

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 (now renamed to VyOS) 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.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean