DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 8th February 2017
Amithapr Amithapr is offline
Fdisk Soldier
 
Join Date: Dec 2015
Posts: 69
Default Traffic Shaping Using PF

Hi,

Currently in my OpenBSD firewall there are traffic shaping rules, but I doubt whether those are working since when the other users are downloading or streaming the PCs that apply the traffic shaping rules are getting slower

My pf.conf's rules are as follows

Code:
ext_if="rl0"
ext_ip="x.x.x.x"
int_if="em0" 
bmpc_wks="{192.168.94.22/32, 192.168.94.23/32, 192.168.94.24/32}"
http_comp="192.168.94.43"
#hrwebserver = "192.168.94.45"

# allow ping icmp_type
icmp_types="{ echoreq, unreach }"
#webports = "{ http, https }"

#General Options -AL
set loginterface $ext_if
set limit { states 40000, frags 5000 }
set optimization normal
set block-policy drop
match all scrub (no-df random-id min-ttl 5 set-tos lowdelay max-mss 1440 reassemble tcp)
#Rules in Traffic Parity Queue Shaping-AL
altq on rl0 cbq bandwidth 3Mb queue {std,bmpc}
queue std bandwidth 2Mb cbq(default ecn borrow)
queue bmpc bandwidth 1Mb cbq(ecn borrow)
pass out on $ext_if proto {tcp, udp} from $bmpc_wks to any port>=80 queue bmpc


Thanks

Last edited by Amithapr; 8th February 2017 at 12:44 PM.
Reply With Quote
  #2   (View Single Post)  
Old 8th February 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Things I notice:
  • You are only shaping traffic outbound from your router upstream to the Internet. You are not shaping outbound traffic downstream to your internal network.
  • You defined two queues but only reference one in the rules you posted.
And, of course, I must remind you again...
  • Altq was removed from OpenBSD in 2014. Your OS is unsupported.
  • You must still be using your OpenBSD 4.1 - 4.2 - 5.3 - n.n system. This deployed system is unsupportable, even if any of the versions within were still supported by the Project.
  • My prior advice to you to reinstall or completely replace this "Frankensystem" remains unchanged.
Reply With Quote
  #3   (View Single Post)  
Old 9th February 2017
Amithapr Amithapr is offline
Fdisk Soldier
 
Join Date: Dec 2015
Posts: 69
Default

Hi jggimi,

Thanks for the information. I tried to get the desired result by adding " pass in on $ext_if proto {tcp, udp} from $bmpc_wks to any port>=80 queue bmpc " before the pass out on rule, still it seems that traffic shaping is not happening.

I have no idea how to implement the other queue(std) that you have mentioned in your reply.

Thanks.

Last edited by Amithapr; 9th February 2017 at 10:49 AM.
Reply With Quote
  #4   (View Single Post)  
Old 9th February 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Your example temporary added rule would never match any traffic. There is never inbound traffic from your workstations on your external network.

Queues are attached to a state when the state is established. So if a state is established on outbound traffic by the pass rule in your top post, the queue would remain assigned for the inbound traffic. I did not see any rules for any other traffic, and that is why I made note of it.

----

Q: When is a queue deployed?

A: When there is outgoing traffic that is delayed waiting for a network connection to become free.

Q: Why only outgoing traffic?

A: Because if a packet has arrived... it is already here. There is nothing to queue. If we are flooded and cannot manage to process the packet, we can drop it, but there is no queue to put it on because is not waiting for an outgoing connection.

Q: Why are my queues not queuing?

A: Your performance delays are likely due to bottlenecks on incoming packets from the Internet. You don't have local queues on Internet inbound traffic because the incoming traffic is much slower than your local network. The ISP's router is queuing the traffic, but your router does not need to.

Q: How can I monitor queues?

A: systat(8) and the pftop package.
Reply With Quote
  #5   (View Single Post)  
Old 1st March 2017
Amithapr Amithapr is offline
Fdisk Soldier
 
Join Date: Dec 2015
Posts: 69
Default

Hi All,

I ran the command systat queues and got to know the std queue is getting priority so I changed the default queue to bmpc. now the traffic shaping rule works. But i'm not sure I did the correct thing. Chnges done are in bold colour.

Code:
ext_if="rl0"
ext_ip="x.x.x.x"
int_if="em0" 
bmpc_wks="{192.168.94.22/32, 192.168.94.23/32, 192.168.94.24/32}"
http_comp="192.168.94.43"
#hrwebserver = "192.168.94.45"

# allow ping icmp_type
icmp_types="{ echoreq, unreach }"
#webports = "{ http, https }"

#General Options -AL
set loginterface $ext_if
set limit { states 40000, frags 5000 }
set optimization normal
set block-policy drop
match all scrub (no-df random-id min-ttl 5 set-tos lowdelay max-mss 1440 reassemble tcp)
#Rules in Traffic Parity Queue Shaping-AL
altq on rl0 cbq bandwidth 3Mb queue {std,bmpc}
queue std bandwidth 50% priority 0 cbq(ecn borrow)
queue bmpc bandwidth 50 % priority 7 cbq(default ecn borrow)
pass out on $ext_if proto {tcp, udp} from $bmpc_wks to any port>=80 queue bmpc
Thanks for your help.....!!!

Reply With Quote
  #6   (View Single Post)  
Old 6th March 2017
Amithapr Amithapr is offline
Fdisk Soldier
 
Join Date: Dec 2015
Posts: 69
Default

Dear All,

It seems that only the bmpc queue is working the std queue is idle, I feel something wrong in my configuration though the bmpc queue is working

systat queues output is attahced
Attached Images
File Type: png bmpc.PNG (14.1 KB, 69 views)
Reply With Quote
  #7   (View Single Post)  
Old 6th March 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

You have set your bmpc queue as your default.
Reply With Quote
  #8   (View Single Post)  
Old 8th March 2017
Amithapr Amithapr is offline
Fdisk Soldier
 
Join Date: Dec 2015
Posts: 69
Default

Hi Jggimi,

I changed the default queue. but the systat command only shows one queue's statistics. The screenshot attached.
Attached Images
File Type: png Queues2.PNG (16.5 KB, 57 views)
Reply With Quote
  #9   (View Single Post)  
Old 8th March 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Please post your revised /etc/pf.conf file.
Reply With Quote
Old 15th March 2017
Amithapr Amithapr is offline
Fdisk Soldier
 
Join Date: Dec 2015
Posts: 69
Default

Hi Jggimi,

Sorry for the late reply. Please find the latest pf.conf file herewith.

Thanks
Attached Files
File Type: conf pf.conf (7.3 KB, 84 views)
Reply With Quote
Old 15th March 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

I don't see anything obviously wrong with your PF configuration.

Noted:
  • You are using "/32" in your $bmpc_wks macro but that should be immaterial.
  • You have only a single rule which assigns a queue to passed traffic. You can confirm whether that rule matches or not by adding the log option to the rule and monitoring traffic with tcpdump(8) and your pflog(4) device. Assuming, of course, that your "Frankensystem" changes have not eliminated that capability.

You don't want me to tell you to upgrade or replace this system, again. Or, to hire support to help you. I think I've tried to tell you to do so about twenty times. So I will only repeat that your system is not supported by the OpenBSD Project, and cannot be supported by me through this forum. You are truly on your own.

The altq subsystem was removed and replaced for very good reasons. Years ago. See http://quigon.bsws.de/papers/2012/bsdcan/

Last edited by jggimi; 15th March 2017 at 04:50 PM. Reason: typos
Reply With Quote
Old 15th March 2017
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Actually, looking again, I note that there are many pass rules after the rule that assigns the queue. If any of them match, the queue will be reassigned to the default.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PF only firefox traffic ? bryn1u OpenBSD Security 12 7th November 2014 04:39 AM
Traffic between two vpn networks bertj FreeBSD Security 4 31st January 2013 02:44 PM
PF Traffic Shaping question. MarcRiv OpenBSD Security 6 28th October 2009 07:22 PM
[FreeBSD + PF cbq + borrow] Dynamic shaping Enemy FreeBSD General 4 19th May 2009 08:56 AM
Dynamic Traffic Shaping LordZ OpenBSD Security 6 19th January 2009 04:30 PM


All times are GMT. The time now is 10:17 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick