Community discussions

 
IntrusDave
Forum Guru
Forum Guru
Topic Author
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Simplified DSCP/QoS Setup Script

Sun Sep 18, 2016 9:09 pm

Here is a simplified (8 queue instead of 64 queue) script to setup basic DSCP and QoS.
Simply set your WAN interface name, and your WAN UPLOAD speed. It will generate the queue tree and mangle rules to get you started.
#Set interface here
:local outboundInterface "wan0"

#Set bandwidth of the interface (remember, this is for OUTGOING)
:local interfaceBandwidth 4M

#Set where in the chain the packets should be mangled
:local mangleChain postrouting

#Don't mess with these. They set the parameters for what is to follow
:local queueName ("QoS_" . $outboundInterface)
:local qosClasses [:toarray "Network Control,Internetwork Control,Critical,Flash Override,Flash,Immedate,Priority,Routine"]

/ip firewall mangle add action=set-priority \
	chain=postrouting new-priority=from-dscp-high-3-bits \
	passthrough=yes comment="Respect DSCP tagging"
/ip firewall mangle add action=set-priority \
	chain=postrouting new-priority=2 packet-size=0-123 \
	passthrough=yes protocol=tcp tcp-flags=ack comment="Prioritize ACKs"
/ip firewall mangle add action=set-priority \
	chain=postrouting priority=0 dscp=0 new-priority=8  \
	passthrough=yes comment="Set Pri 8 on packets with no tag at all"


:for indexA from 0 to 7 do={
    /ip firewall mangle add action=mark-packet chain=$mangleChain comment=("pri_" . $indexA+1) \
         disabled=no priority=($indexA+1) new-packet-mark=("priority_" . $indexA+1) passthrough=no
}

/queue tree add max-limit=$interfaceBandwidth name=$queueName parent=$outboundInterface priority=1
:for indexA from=0 to=7 do={
	:local subClass ([:pick $qosClasses $indexA] )
	/queue tree add \ 
		name=($indexA+1 . ". " . $subClass . " - " . $outboundInterface ) \
		parent=$queueName \
		priority=($indexA+1) \
		queue=ethernet-default \
		packet-mark=("priority_" . $indexA+1) \
		comment=("Priority " . $indexA+1 . " traffic")
}
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
User avatar
amt
Long time Member
Long time Member
Posts: 526
Joined: Fri Jan 16, 2015 2:05 pm

Re: Simplified DSCP/QoS Setup Script

Mon Jun 19, 2017 1:32 pm

what will happen after this ? what will be the benefits ?
 
IntrusDave
Forum Guru
Forum Guru
Topic Author
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: Simplified DSCP/QoS Setup Script

Mon Jun 19, 2017 5:55 pm

Your router will honor the QOS tagging in the packets
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
User avatar
amt
Long time Member
Long time Member
Posts: 526
Joined: Fri Jan 16, 2015 2:05 pm

Re: Simplified DSCP/QoS Setup Script

Tue Jun 20, 2017 8:02 am

Hi Dave,
I would like to make videos faster for the customer then voip can i use QoS for this option ?
 
IntrusDave
Forum Guru
Forum Guru
Topic Author
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: Simplified DSCP/QoS Setup Script

Tue Jun 20, 2017 9:18 am

Yes, you would need to mangle rules to mark the packets with the priority that you want them to have.
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
User avatar
amt
Long time Member
Long time Member
Posts: 526
Joined: Fri Jan 16, 2015 2:05 pm

Re: Simplified DSCP/QoS Setup Script

Tue Jun 20, 2017 9:36 am

Hi dave,
What about your rules ? how they worked ?

Thanks
 
IntrusDave
Forum Guru
Forum Guru
Topic Author
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: Simplified DSCP/QoS Setup Script

Tue Jun 20, 2017 9:48 am

The mangle rules created by the script only mark the packets for DSCP. You will need to create new rules to set the DSCP for the video packets. Keep in mind that QoS only works for your outbound traffic. Unless you are using an MPLS for your WAN, you can not control your inbound QoS.
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
User avatar
amt
Long time Member
Long time Member
Posts: 526
Joined: Fri Jan 16, 2015 2:05 pm

Re: Simplified DSCP/QoS Setup Script

Tue Jun 20, 2017 10:06 am

thanks for your help...
 
neutronlaser
Member Candidate
Member Candidate
Posts: 212
Joined: Thu Jan 18, 2018 5:18 pm

Re: Simplified DSCP/QoS Setup Script

Fri Feb 01, 2019 4:46 pm

Script fails and says 'ambiguous value of parent, more than one possible value matches input'
 
neutronlaser
Member Candidate
Member Candidate
Posts: 212
Joined: Thu Jan 18, 2018 5:18 pm

Re: Simplified DSCP/QoS Setup Script

Sun Mar 10, 2019 1:03 am

What a crock, just put some QoS in quickset already.
 
User avatar
c400
just joined
Posts: 12
Joined: Tue Nov 07, 2017 11:19 pm

Re: Simplified DSCP/QoS Setup Script

Mon Apr 15, 2019 9:45 pm

Hello,
Will this work, if i add it next line after "Set Pri 8 on packets with no tag at all"?
/ip firewall mangle add action=set-priority chain=postrouting new-priority=5 passthrough=yes protocol=tcp port=22
thx for a great script!
 
IntrusDave
Forum Guru
Forum Guru
Topic Author
Posts: 1290
Joined: Fri May 09, 2014 4:36 am
Location: Rancho Cucamonga, CA

Re: Simplified DSCP/QoS Setup Script

Tue Apr 16, 2019 5:21 am

that should work just fine, but place it before the Priority 8 line.
David Joyce
Network & Security Engineer
Intrus Technologies, LLC.
Rancho Cucamonga, CA, USA
 
prozak
newbie
Posts: 26
Joined: Sat Jan 16, 2010 4:01 am

Re: Simplified DSCP/QoS Setup Script

Wed Jun 12, 2019 6:48 pm

Hello.
I have a Question,
Does this script really honor and prioritizes VoIP instead of bulk traffic like web downloads?
Isn't there any need to set limit-at to guarantee critical dscp tagging enough bandwidth?
I mean in case there's a link saturation by bulk traffic so to avoid any VoIP jitters?

Also another sort of irrelevant question
If your VoIP service is through a VPN, are the packets tagged? or are they masked through VPN with no tag?

Any comments will be appreciated
 
User avatar
c400
just joined
Posts: 12
Joined: Tue Nov 07, 2017 11:19 pm

Re: Simplified DSCP/QoS Setup Script

Sun Aug 18, 2019 9:37 am

Trying to prioritize traffic over LTE, found that outgoing speed can vary from 10mbits to 25mbits. Should i set
:local interfaceBandwidth
to minimum value? Or it will be harmful for maximum bandwidth?
thx!

Who is online

Users browsing this forum: No registered users and 3 guests