The FreeBSD Handbook had this to say regarding net.inet.ip.portrange.* sysctl variables:
“The net.inet.ip.portrange.* sysctl(8) variables control the port number ranges automatically bound to TCP and UDP sockets. There are three ranges: a low range, a default range, and a high range. Most network programs use the default range which is controlled by net.inet.ip.portrange.first and net.inet.ip.portrange.last, which default to 1024 and 5000, respectively. Bound port ranges are used for outgoing connections and it is possible to run the system out of ports under certain circumstances. This most commonly occurs when running a heavily loaded web proxy. The port range is not an issue when running a server which handles mainly incoming connections, such as a web server, or has a limited number of outgoing connections, such as a mail relay. For situations where there is a shortage of ports, it is recommended to increase net.inet.ip.portrange.last modestly. A value of 10000, 20000 or 30000 may be reasonable. Consider firewall effects when changing the port range. Some firewalls may block large ranges of ports, usually low-numbered ports, and expect systems to use higher ranges of ports for outgoing connections. For this reason, it is not recommended that the value of net.inet.ip.portrange.first be lowered.”
FreeBSD 11.1 deploys values contrary to those above:
# uname -sr
# sysctl net.inet.ip.portrange
A commit in March 2008 sets net.inet.ip.portrange.first and last to 10000 and 65535 respectively. It’s apparently obvious The FreeBSD Handbook includes obsolete guidelines. This raises the question “how does this change the advice given in The Handbook?”
Can The Handbook be updated to reflect modern guidelines surrounding using these kernel tunables?
I went looking for information about net.inet.ip.portrange and found this PR. Nearly time to start pre-school.
Unfortunately the sysctl doc is quite scant
# sysctl -d net.inet.ip.portrange
net.inet.ip.portrange: IP Ports
net.inet.ip.portrange.randomtime: Minimum time to keep sequental port allocation before switching to a random one
net.inet.ip.portrange.randomcps: Maximum number of random port allocations before switching to a sequental one
net.inet.ip.portrange.randomized: Enable random port allocation
and the "man tuning" on 12.2Stable is similar to the handbook.