19d7ccc0fSMax Laier# $FreeBSD$ 242a227f8SMax Laier# $OpenBSD: ackpri,v 1.3 2006/10/07 04:48:01 mcbride Exp $ 39d7ccc0fSMax Laier 49d7ccc0fSMax Laier# Use a simple priority queue to prioritize empty (no payload) TCP ACKs, 59d7ccc0fSMax Laier# which dramatically improves throughput on (asymmetric) links when the 69d7ccc0fSMax Laier# reverse direction is saturated. The empty ACKs use an insignificant 79d7ccc0fSMax Laier# part of the bandwidth, but if they get delayed, downloads suffer 89d7ccc0fSMax Laier# badly, so prioritize them. 99d7ccc0fSMax Laier 109d7ccc0fSMax Laier# Example: 512/128 kbps ADSL. Download is 50 kB/s. When a concurrent 119d7ccc0fSMax Laier# upload saturates the uplink, download drops to 7 kB/s. With the 129d7ccc0fSMax Laier# priority queue below, download drops only to 48 kB/s. 139d7ccc0fSMax Laier 149d7ccc0fSMax Laier# Replace lo0 with your real external interface 159d7ccc0fSMax Laier 169d7ccc0fSMax Laierext_if="lo0" 179d7ccc0fSMax Laier 189d7ccc0fSMax Laier# For a 512/128 kbps ADSL with PPPoE link, using "bandwidth 100Kb" 199d7ccc0fSMax Laier# is optimal. Some experimentation might be needed to find the best 209d7ccc0fSMax Laier# value. If it's set too high, the priority queue is not effective, and 219d7ccc0fSMax Laier# if it's set too low, the available bandwidth is not fully used. 229d7ccc0fSMax Laier# A good starting point would be real_uplink_bandwidth * 90 / 100. 239d7ccc0fSMax Laier 249d7ccc0fSMax Laieraltq on $ext_if priq bandwidth 100Kb queue { q_pri, q_def } 259d7ccc0fSMax Laierqueue q_pri priority 7 269d7ccc0fSMax Laierqueue q_def priority 1 priq(default) 279d7ccc0fSMax Laier 2842a227f8SMax Laierpass out on $ext_if proto tcp from $ext_if to any queue (q_def, q_pri) 299d7ccc0fSMax Laier 3042a227f8SMax Laierpass in on $ext_if proto tcp from any to $ext_if queue (q_def, q_pri) 319d7ccc0fSMax Laier 32