EdgeRouter - Set traffic policies for upload, download and VoIP

Overview


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

Configurations


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 Traffic Policy

Note: One class is for each client.

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

This is applied to the interface out policy of the interface:

set interfaces ethernet eth1 traffic-policy out 'client-down'
commit

Example of Upload Traffic 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 applied to the interface out policy of the interface:

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

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

Example of VoIP Traffic Policy 

Note: VoIP has traffic highest priority with very little latency and/or jitter, ssh has low delay, and all other types of traffic have equal priority.

traffic-policy {
   shaper interactive-bulk {
        bandwidth 2mbit
        class 10 {
            bandwidth 5%
            burst 2.5k
            ceiling 30%
            match RTP {
                ip {
                    dscp 46
                }
            }
            match RTP-IPv6 {
                ipv6 {
                   dscp 46
                }
            }
            priority 7
            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 {
                ip {
                    destination {
                        port 22
                    }
                    dscp lowdelay
                    protocol tcp
                }
            }
            match ssh-ipv6 {
                ipv6 {
                    destination {
                        port 22
                    }
                    protocol tcp
                }
            }
            priority 6
            queue-limit 10
            queue-type fair-queue
        }
        default {
            bandwidth 85%
            burst 2.5k
            ceiling 100%
            priority 2
            queue-limit 13
            queue-type fair-queue
        }
    }
}

Related Articles


 

Powered by Zendesk