xref: /freebsd/share/examples/pf/ackpri (revision 2008043f386721d58158e37e0d7e50df8095942d)
1# $OpenBSD: ackpri,v 1.3 2006/10/07 04:48:01 mcbride Exp $
2
3# Use a simple priority queue to prioritize empty (no payload) TCP ACKs,
4# which dramatically improves throughput on (asymmetric) links when the
5# reverse direction is saturated. The empty ACKs use an insignificant
6# part of the bandwidth, but if they get delayed, downloads suffer
7# badly, so prioritize them.
8
9# Example: 512/128 kbps ADSL. Download is 50 kB/s. When a concurrent
10# upload saturates the uplink, download drops to 7 kB/s. With the
11# priority queue below, download drops only to 48 kB/s.
12
13# Replace lo0 with your real external interface
14
15ext_if="lo0"
16
17# For a 512/128 kbps ADSL with PPPoE link, using "bandwidth 100Kb"
18# is optimal. Some experimentation might be needed to find the best
19# value. If it's set too high, the priority queue is not effective, and
20# if it's set too low, the available bandwidth is not fully used.
21# A good starting point would be real_uplink_bandwidth * 90 / 100.
22
23altq on $ext_if priq bandwidth 100Kb queue { q_pri, q_def }
24queue q_pri priority 7
25queue q_def priority 1 priq(default)
26
27pass out on $ext_if proto tcp from $ext_if to any queue (q_def, q_pri)
28
29pass in  on $ext_if proto tcp from any to $ext_if queue (q_def, q_pri)
30
31