info_i_25x25.png Due to unforeseen weather conditions we are experiencing higher chat wait times. Remember you can also submit a ticket and one of our support representatives will get back to you as soon as possible. We apologize for the inconvenience.

EdgeRouter - Traffic Policies (Shaper) for Upload, Download and VoIP


Overview


Readers will learn how to set traffic policies (upload / download / VoIP) on EdgeRouters via CLI. 

NOTES & REQUIREMENTS:
Applicable to the latest EdgeOS firmware on all EdgeRouter models. Knowledge of the Command Line Interface (CLI) and basic networking knowledge is required. Please see the Related Articles below for more information and see the attachments for the configuration used in this article.
 
Devices used in this article:

Configuration


The following example uses two traffic policies (one for upload, one for download) to limit client 10.0.3.2 to an upload rate of 512Kbps (allowing bursts to 640Kbps) and downloads of 1Mbit (allowing bursts to 1.5Mbit if the bandwidth is available). 

Example of Download Policy

CLI: Access the command line interface (CLI). You can do this using the CLI button in the GUI or by using a program such as PuTTY.
configure
set traffic-policy shaper client-down bandwidth '1000mbit' set traffic-policy shaper client-down class 2 bandwidth '1mbit' set traffic-policy shaper client-down class 2 burst '1k' set traffic-policy shaper client-down class 2 ceiling '1.5mbit' set traffic-policy shaper client-down class 2 match ADDR ip destination address '10.0.3.2/32' set traffic-policy shaper client-down class 2 queue-type 'fair-queue' set traffic-policy shaper client-down class 3 bandwidth '1mbit' set traffic-policy shaper client-down class 3 burst '1k' set traffic-policy shaper client-down class 3 ceiling '1.5mbit' set traffic-policy shaper client-down class 3 match ADDR ip destination address '10.0.3.3/32' set traffic-policy shaper client-down class 3 queue-type 'fair-queue' set traffic-policy shaper client-down default bandwidth '100%' set traffic-policy shaper client-down default burst '1k' set traffic-policy shaper client-down default ceiling '100%' set traffic-policy shaper client-down default queue-type 'fair-queue' commit
NOTE: One class is for each client.

This is applied to the interface out policy:

set interfaces ethernet eth1 traffic-policy out client-down
commit ; save

Example of Upload Policy

For the upload traffic policy we have two options. The most straightforward is a limiter policy:

set traffic-policy limiter client-up class 1 bandwidth '512kbit'
set traffic-policy limiter client-up class 1 burst '1mb'
set traffic-policy limiter client-up class 1 match ADDR ip source address '10.0.3.2/32'
set traffic-policy limiter client-up default bandwidth '1000mbit'
commit

This is then applied to the interface in policy:

set interfaces ethernet eth1 traffic-policy in 'client-up'
commit ; save

The downside to a limiter policy is that it works well for traffic destined for the router, but it's less accurate for traffic being forwarded. Another option is to create an input interface and then create a shaper for the input interface:

set traffic-policy shaper client-up-s bandwidth '1000mbit'
set traffic-policy shaper client-up-s class 2 bandwidth '512kbit'
set traffic-policy shaper client-up-s class 2 burst '1k'
set traffic-policy shaper client-up-s class 2 ceiling '640kbit'
set traffic-policy shaper client-up-s class 2 match ADDR ip source address '10.0.3.2/32'
set traffic-policy shaper client-up-s class 2 queue-type 'fair-queue'
set traffic-policy shaper client-up-s class 3 bandwidth '512kbit'
set traffic-policy shaper client-up-s class 3 burst '1k'
set traffic-policy shaper client-up-s class 3 ceiling '640kbit'
set traffic-policy shaper client-up-s class 3 match ADDR ip source address '10.0.3.3/32'
set traffic-policy shaper client-up-s class 3 queue-type 'fair-queue'
set traffic-policy shaper client-up-s default bandwidth '100%'
set traffic-policy shaper client-up-s default burst '15k'
set traffic-policy shaper client-up-s default ceiling '100%'
set traffic-policy shaper client-up-s default queue-type 'fair-queue'
commit

Create a shaper for the input interface:

set interfaces ethernet eth1 redirect 'ifb1'
set interfaces input ifb1 traffic-policy out 'client-up-s'
commit ; save

Example of VoIP Traffic Policy using priorities

  • Class 10 VoIP uses priority 0 (highest)
  • Class 20 ICMP uses priority 4
  • Class 30 SSH uses priority 3
  • Default traffic uses priority 7 (lowest)
show configuration
...
traffic-policy { shaper interactive-bulk { bandwidth 2mbit class 10 { bandwidth 5% burst 2.5k ceiling 30% match voip-ipv4 { ip { dscp 46 } } match voip-ipv6 { ipv6 { dscp 46 } } priority 0 queue-limit 10 queue-type fair-queue } class 20 { bandwidth 5% burst 2.5k match icmp { ip { protocol icmp } } match SIP { ip { dscp 26 } } match SIP-IPv6 { ipv6 { dscp 26 } } priority 4 queue-limit 10 queue-type fair-queue } class 30 { bandwidth 5% burst 1k ceiling 20% match ssh-ipv4 { ip { destination { port 22 } protocol tcp } } match ssh-ipv6 { ipv6 { destination { port 22 } protocol tcp } } priority 3 queue-limit 10 queue-type fair-queue } default { bandwidth 85% burst 2.5k ceiling 100% priority 7 queue-limit 13 queue-type fair-queue } } }

Related Articles


Back to Top

Intro to Networking - How to Establish a Connection Using SSH