Question

OpenBSD PF Firewall ALTQ for VOIP Priority

Asked by: plexter2k

Hello all,

I've been trying to get PF ALTQ setup and for the life of me I cannot figure out what the errors below are meaning, or at least what they are asking me to change. I have tried playing around with the values with no luck! I'm hoping someone here can assist with setting this up.

Before I get into the errors I will first outline what I am trying to accomplish with ALTQ.

I have chosen to work with HFSC as it seemed like the best option for VOIP. If this was an incorrect choice please let me know.

My ALTQ is supposed to help reduce network congestion as I am using both time sensitive and non-time sensitive services. However I would have preferred my total bandwidth to be shared by all the queues (borrow w/ CBQ) as I do not really care if one queue takes up most or all of the bandwidth as long as it gives it back when something like VOIP needs it.

VOIP vs bittorent basically. So I am looking to firstly prioritize VOIP over everything so my calls still work while also making sure traffic still flows (even if it is slower) and finally I am trying to optimize the flow of Ack's as I am on an ADSL line.

ACK Pri Ref #1: http://www.benzedrine.cx/ackpri.html
ACK Pri Ref #2: http://www.openbsd.org/faq/pf/queueing.html

Could you please assist with:

1. Getting my ALTQ working properly for my situation
2. Making sure I am doing the ACK prioritization properly.  


Thanks for your help!

ALTQ Portion of PF:
 
altq on $ext_if bandwidth 600Kb hfsc queue { ack, dns, ssh, webftp, bitt, voip, rdpvnc, general }
 
 
queue ack priority 7 qlimit 500 hfsc (realtime 20% red ecn)
Note: I am not sure how much I should devote to ACK packets --comments?
 
queue voip priority 6 qlimit 500 hfsc (realtime 65% red enc)
queue dns priority 5 qlimit 500 hfsc (realtime 5% red ecn)
queue ssh priority 4 qlimit 500 hfsc (realtime 2% red ecn) {ssh_login, ssh_bulk}
queue ssh_login priority 4 qlimit 500
queue ssh_bulk priority 3 qlimit 500
rdpvnc priority 4 qlimit 500 hfsc (realtime 3% red ecn)
webftp priority 4 qlimit 500 hfsc (upperlimit 70% red ecn)
games priority 2 qlimit 500 hfsc (upperlimit 70% red ecn)
bitt     priority 3 qlimit 500 hfsc (upperlimit 80% red enc)
general priority 1 qlimit 500 hfsc (upperlimit 75% red ecn default)
 
 
 
 
Errors When Running PF:
 
pfctl: linkshare sc exceeds parent's sc 
/etc/pf.conf:34: errors in queue definition
pfctl: the sum of the child bandwidth higher than parent "root_fxp0" 
pfctl: linkshare sc exceeds parent's sc
/etc/pf.conf:35: errors in queue definition
parent ssh not found for ssh_login
/etc/pf.conf:36: errors in queue definition
 
Line 35 as an example is the start of my SSH queue
 
....and on and on...
 
 
 
 
PASS Rules For PF:
 
pass out quick on $ext_if inet proto udp from any to any port 5060 keep state queue (voip, ack)
pass out quick on $ext_if inet proto udp from any to any port domain keep state queue (dns, ack)
pass out quick on $ext_if inet proto tcp from any to any port ssh modulate state queue (ssh_bulk, ssh_login)
pass out quick on $ext_if inet proto (tcp, udp) from any to any keep state queue (general, ack)
 
and I have one for each queue...

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-10-14 at 14:39:46ID23814646
Tags

OpenBSD

,

PF Packet Filter

,

4.3

,

Firewall ALTQ

Topics

OpenBSD

,

Unix Network Security

,

Network Software Firewalls

Participating Experts
1
Points
500
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. VoIP behind PF firewall
    Hello all! I have VoIP device D-Link DVG-1104TH and I dont have additional IP adress. So I want to place this device behind firewall PF (OpenBSD). Can I Do this? Is PF support H.323 protocol? Thanks, Serg
  2. VoIP UK
    What are VoIp Termination Services. can somebody explain me this business. For a VoIP Setup in UK from a IPSoftphone to the Gateway, how are the call termination charges treated in UK? are we billed for terminations into other peoples networks? How are the dealing with carrie...
  3. voip terminations
    Dear friends I would like to start my own voip termination biz, am planning to locate voip gateway in my city to connect my national telephone network to the internet so I will be able to sell calling termination (mints) to other countries So can you tell me how to do it …...
  4. Reserve Bandwidth for VoIP softphone
    Hi, I am new to VoIP and am currently trialing the GoTalk softphone (eyebeam) - The quality changes depending upon internet traffic (obviously). I was wondering if anyone knew of a software solution to reserve a segement of the bandwidth for the softphone over any other inte...
  5. voip - pdd
    hi, what does pdd stands for in voip term? regards

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: gheistPosted on 2008-10-16 at 02:43:33ID: 22729163

ECN does not always work esp over frame relay, vpn and the likes.
There is usually one ack packet over 12k-64k window. It has no data just header. Over serial line that would make 1/1000 of bytes transferred, On ethernet given we send always full frame that will be 1/40 of traffic. If we experience resending things change for worse.

I'd suggest blindly adding 1:1:1:1 for each of  classes and unallocated in each priority group (And then pfctl -s queues to see overused ones)

 

by: gheistPosted on 2008-10-16 at 02:45:17ID: 22729170

Actually you have to give high priority to DNS access so users get good interactive response out of web browsers, and NTP should have highest priority possible so that clocks are accurate if you use it.

 

by: plexter2kPosted on 2008-10-16 at 10:06:20ID: 22733285

Hi gheist,

thank you for the response however I would not be able to implement anything until my ALTQ is working.

While I was waiting for a reply I tried implementing CBQ to see if this would work any better.

I get a different error which may also be why HFSC was not working.

The errors says there is something wrong with line 30. This is my opening ALTQ statement. I do not anything wrong!

I have attached my PF.CONF.

Hope you can help!
Thanks

#Interfaces
ext_if="fxp0"
int_if="fxp1"
 
#Options
set require-order yes
set block-policy drop
set loginterface $ext_if
set state-policy if-bound
set fingerprints "/etc/pf.os"
set ruleset-optimization none
 
#Timeout Settings
set optimization aggressive
set timeout { frag 10, tcp.established 3600 }
set timeout { tcp.first 30, tcp.closing 10, tcp.closed 10, tcp.finwait 10 }
set timeout { udp.first 30, udp.single 30, udp.multiple 30 }
set timeout { other.first 30, other.single 30, other.multiple 30 }
set timeout { adaptive.start 5000, adaptive.end 10000 }
 
#Connection Normalization
 
scrub on $ext_if all random-id min-ttl 254 max-mss 1452 reassemble tcp fragment reassemble
 
#Queuing ALTQ
#Upload assumed aprox 80kb or 640Kb queued aprox 94%
 
altq on $ext_if cbq bandwidth 600Kb qlimit 500 queue { tos, dns, ssh, webftp, bitt, voip, rdpvnc, general }
 
queue   tos     bandwidth 20% priority 7      qlimit 500 cbq (borrow red ecn) { ack, ssh_login }
                queue   ack             bandwidth 90%   qlimit 500 cbq (borrow red ecn)
                queue   ssh_login       bandwidth 10%   qlimit 500 cbq (borrow red ecn)
queue   voip    bandwidth 50% priority 6      qlimit 500 cbq (borrow red ecn)
queue   dns     bandwidth 5%  priority 5      qlimit 500 cbq (borrow red ecn)
queue   ssh     bandwidth 2%  priority 4      qlimit 500 cbq (borrow red ecn)
queue   webftp  bandwidth 5%  priority 4      qlimit 500 cbq (borrow red ecn)
queue   games   bandwidth 5%  priority 3      qlimit 500 cbq (borrow red ecn)
queue   bitt    bandwidth 10% priority 2      qlimit 500 cbq (borrow red ecn)
queue   general bandwidth 3%  priority 1      qlimit 500 cbq (borrow red ecn default)
 
pass out quick on $ext_if inet proto udp from any to any port 5060 keep state queue (voip, ack)
pass out quick on $ext_if inet proto udp from any to any port domain keep state queue (dns, ack)
pass out quick on $ext_if inet proto tcp from any to any port ssh modulate state queue (ssh, ssh_login)
pass out quick on $ext_if inet proto tcp from any to any port 3389 modulate state queue (rdpvnc, ack)
pass out quick on $ext_if inet proto udp from any to any port 30340:30341 keep state queue (games, ack)
pass out quick on $ext_if inet proto udp from any to any port 6112 keep state queue (games, ack)
pass out quick on $ext_if inet proto tcp from any to any port 10050 modulate state queue (bitt, ack)
pass out quick on $ext_if inet proto (tcp, udp) from any to any keep state queue (general, ack)
 
pass in
pass out

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:

Select allOpen in new window

 

by: gheistPosted on 2008-10-16 at 23:04:30ID: 22738067

Have you got altq and all schedulers in your kernel?
Try loading with pfctl -nvf that will give you exact line when problems occur with somewhat explaining error message

 

by: plexter2kPosted on 2008-10-17 at 06:38:26ID: 22740556

It was my understanding that OpenBSD comes with full support for PF right out of the box. Am I incorrect in this assumption?

 

by: gheistPosted on 2008-10-17 at 10:38:37ID: 22743249

500 ethernet frames packets over 600kbps line would take 10 seconds to clear. I think autotuning of queue sizes is smarter than me and you.

I guess queue of line 30 exhausts resources of queue defined at line 28 (if both are syntactically correct at all)

 

by: plexter2kPosted on 2008-10-18 at 10:41:21ID: 22749051

Hello,

I have removed all the queue size limits as I don't really care about them anyhow.  At least not now or until I need to. :P

I tried starting with your pfctl -nvf ... and I see all the config pop up followed by the same error. "Syntax incorrect"

I believe there is a bit of a mistake here. I think line 30 is showing up wrong. Line 30 in my actual config is the first line of ALTQ (line 28 on this site)

altq on $ext_if cbq bandwidth 600Kb queue { tos, dns, ssh, webftp, bitt, voip, rdpvnc, general }

Is now how it should be reading.

I just don't get why it says syntax error.




 

by: gheistPosted on 2008-10-18 at 13:24:46ID: 22749631

I am running priq with 3 classes and happy with that. No bw and queue accounting when configuring and all that.

Errors in initial post say:
children use more than IF bandwidth and more queue space than parent has.

 

by: plexter2kPosted on 2008-10-18 at 15:20:04ID: 22750021

Correct my original post was using HFSC queuing.

I have switched to CBQ as noted in the following post which did not produce near as many errors. I also noted that I think both CBQ and HFSC were having trouble for the same issue at hand now.

For some reason my main ALTQ statement is not accepted. This is causing all commands thereafter to produce errors because the PARENT queue no longer exists.


 

by: plexter2kPosted on 2008-10-18 at 15:22:49ID: 22750031

Also see the code I have modified my pf.conf to be even simpler with no queue limitations...etc manually set (noted above).

Once again the line numbers referenced in the code are not the same as those on the OpenBSD box.

#Interfaces
ext_if="fxp0"
int_if="fxp1"
 
#Options
set require-order yes
set block-policy drop
set loginterface $ext_if
set state-policy if-bound
set fingerprints "/etc/pf.os"
set ruleset-optimization none
 
#Timeout Settings
set optimization aggressive
set timeout { frag 10, tcp.established 3600 }
set timeout { tcp.first 30, tcp.closing 10, tcp.closed 10, tcp.finwait 10 }
set timeout { udp.first 30, udp.single 30, udp.multiple 30 }
set timeout { other.first 30, other.single 30, other.multiple 30 }
set timeout { adaptive.start 5000, adaptive.end 10000 }
 
#Connection Normalization
 
scrub on $ext_if all random-id min-ttl 254 max-mss 1452 reassemble tcp fragment reassemble
 
#Queuing ALTQ
#Upload assumed aprox 80kb or 640Kb queued aprox 94%
 
altq on $ext_if cbq bandwidth 600Kb queue { tos, voip, dns, ssh, webftp, bitt, general }
 
queue   tos     bandwidth 20% priority 7      cbq (borrow red) { ack, ssh_login }
                queue   ack             bandwidth 90%   cbq (borrow red)
                queue   ssh_login       bandwidth 10%   cbq (borrow red)
queue   voip    bandwidth 50% priority 6      cbq (borrow red)
queue   dns     bandwidth 7%  priority 5      cbq (borrow red)
queue   ssh     bandwidth 3%  priority 4      cbq (borrow red)
queue   webftp  bandwidth 5%  priority 4      cbq (borrow red)
queue   bitt    bandwidth 10% priority 2      cbq (borrow red)
queue   general bandwidth 5%  priority 1      cbq (borrow red default)
 
pass out quick on $ext_if inet proto udp from any to any port 5060 keep state queue (voip, ack)
pass out quick on $ext_if inet proto udp from any to any port domain keep state queue (dns, ack)
pass out quick on $ext_if inet proto tcp from any to any port ssh modulate state queue (ssh, ssh_login)
pass out quick on $ext_if inet proto tcp from any to any port 10050 modulate state queue (bitt, ack)
pass out quick on $ext_if inet proto { tcp, udp } from any to any keep state queue (general, ack)
 
pass in
pass out

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:

Select allOpen in new window

 

by: gheistPosted on 2008-10-18 at 15:37:05ID: 22750086

There is no problem with this one line:

altq on $ext_if cbq bandwidth 600Kb qlimit 500 queue { tos, dns, ssh, webftp, bitt, voip, rdpvnc, general }

qlimit 500 on next line actually uses all the interface queue and rest of rules do not load.

please disable all of ECN usage. That is feedback protocol and very unlikely to be working at 640kbps consumer line.

 

by: gheistPosted on 2008-10-18 at 15:39:13ID: 22750094

this effectively disconnects you from the internet behind next router:
min-ttl 254


 

by: plexter2kPosted on 2008-10-18 at 16:11:03ID: 22750187

Okay what does that have to do with ALTQ?

 

by: gheistPosted on 2008-10-18 at 16:20:30ID: 22750210

If you unplug network cable internet does not come into your house.

Can you post errors from pfctl -evf on that last config file. I have OpenBSD 3.5 where altq is outside PF, so I cannot help.

 

by: plexter2kPosted on 2008-10-19 at 14:24:14ID: 22753788

Hello again,

The box is already off of the net. It is not a production box yet since it does not work.

I thought I had already posted the error. SYNTAX ERROR on LINE 30 (28 on the above pf.conf)

altq on $ext_if cbq bandwidth 600Kb queue { tos, voip, dns, ssh, webftp, bitt, general }

 

by: gheistPosted on 2008-10-19 at 15:15:59ID: 22753959

It may count lines not commented or lines containing actual statements...
at least ipf did so long ago. so I suspect lines defining queues a bit further.

line you mentioned matches whats described in pf.conf manual page, so I assume no problem there.

what is with webftp queue ? May it complain it is not used hard way?
I am to install latest OpenBSD to do some testing on my own. expect more in couple of days.

 

by: plexter2kPosted on 2008-10-24 at 14:36:36ID: 22800319

Hello gheist,

I am not sure exactly what I've done but i tried PRIQ based off of someone elses script and that worked fine! Then I tried CBQ again but a little simpler than my original and it works fine now also!!! I HAVE NO IDEA what is different or why its working now, but it is!

So thanks for your input none the less. :)

I believe I should be fine for now...at least until I encounter a new mystery!

 

by: gheistPosted on 2008-10-24 at 15:22:59ID: 22800575

If PRIQ does not do its job - i.e. high-priority class takes over all traffic and some other traffic gets stuck, go explore CBQ.
Basically CBQ is available on Hi-End routers, and does good there. Best home gateway devices do look similar to workings of PRIQ.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...