Veteran Member
Posts: 16,734
Registered: ‎06-23-2010
Kudos: 5289
Solutions: 78

Traffic Shaping - Only When Needed

set traffic-policy shaper shaper1 bandwidth 100mbit
set traffic-policy shaper shaper1 default bandwidth 60mbit
set traffic-policy shaper shaper1 class 2 bandwidth 20mbit
set traffic-policy shaper shaper1 class 2 match client2 ip source address 10.0.1.2/32
set traffic-policy shaper shaper1 class 3 bandwidth 20mbit
set traffic-policy shaper shaper1 class 3 match client3 ip source address 10.0.1.3/32
set interfaces ethernet eth0 traffic-policy out shaper1
commit

 ^^^^ From the wiki.

Is there a way to modify this such that the rules will only apply when the bandwidth of the total interface is near capacity?

EXAMPLE: eth0 is a 100meg circuit.   If the circuit is not near capacity, I want to allow everyone to use whatever.  However, as we reach 80-90meg+ I want to give priority/dedicated bandwidth to a certain IP range.

Regular Member
Posts: 745
Registered: ‎11-06-2013
Kudos: 230
Solutions: 26

Re: Traffic Shaping - Only When Needed

Set each class to a percentage instead of a fixed amount. Then allow each class to use 100%

Something like this (please test, i did not):

 

ubnt@ubnt:~$ show configuration commands traffic-policy
set traffic-policy shaper VoIP bandwidth 9000kbit
set traffic-policy shaper VoIP class 10 bandwidth 75%
set traffic-policy shaper VoIP class 10 burst 15k
set traffic-policy shaper VoIP class 10 ceiling 100%
set traffic-policy shaper VoIP class 10 description 'VoIP Traffic'
set traffic-policy shaper VoIP class 10 match IAX2 ip destination port 4569
set traffic-policy shaper VoIP class 10 match RTP ip dscp 46
set traffic-policy shaper VoIP class 10 match RTP-IPv6 ipv6 dscp 46
set traffic-policy shaper VoIP class 10 queue-type fair-queue
set traffic-policy shaper VoIP class 20 bandwidth 5%
set traffic-policy shaper VoIP class 20 burst 15k
set traffic-policy shaper VoIP class 20 ceiling 100%
set traffic-policy shaper VoIP class 20 description 'VoIP SIP Traffic'
set traffic-policy shaper VoIP class 20 match ICMP ip protocol ICMP
set traffic-policy shaper VoIP class 20 match SIP ip dscp 26
set traffic-policy shaper VoIP class 20 match SIP-IPv6 ipv6 dscp 26
set traffic-policy shaper VoIP class 20 queue-type fair-queue
set traffic-policy shaper VoIP default bandwidth 20%
set traffic-policy shaper VoIP default burst 15k
set traffic-policy shaper VoIP default ceiling 100%
set traffic-policy shaper VoIP default queue-type fair-queue
ubnt@ubnt:~$

 

Highlighted
Emerging Member
Posts: 75
Registered: ‎06-07-2013
Kudos: 22
Solutions: 3

Re: Traffic Shaping - Only When Needed

all my torrent traffic goes out 1 ip address, and thats my one class i have, it can use 100% of the bandwidth, however when anything else demands bandwidth it cripples the torrent traffic to a screetching halt

this is the way i setup my shaper, it works great, i never even notice i have traffic going out when torrents are running

ubnt@ubnt# show traffic-policy
 shaper shape1 {
     bandwidth 24.25mbit
     class 5 {
         bandwidth 3%
         burst 512
         ceiling 100%
         match bt {
             ip {
                 destination {
                     address 63.142.161.15/32
                 }
             }
         }
         priority 7
         queue-type fair-queue
     }
     default {
         bandwidth 10%
         burst 512
         ceiling 100%
         priority 4
         queue-type fair-queue
     }
 }