sysctl.si › Parameters › net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range
Port range for outgoing connections. Limits connections per destination.
- Default
- 32768 60999
- Typical value
- 1024 65535 on proxies
When to change it
Widen it on proxies and clients that open many outgoing connections to the same destination.
Check the current value
sysctl net.ipv4.ip_local_port_range
Change it until the next reboot
sudo sysctl -w net.ipv4.ip_local_port_range=1024 65535
Make it permanent
echo "net.ipv4.ip_local_port_range = 1024 65535" | sudo tee /etc/sysctl.d/99-custom.conf sudo sysctl --system
Related parameters
net.core.somaxconn · net.ipv4.tcp_max_syn_backlog · net.core.netdev_max_backlog · net.core.rmem_max · net.core.wmem_max · net.ipv4.tcp_congestion_control · net.core.default_qdisc · net.ipv4.tcp_tw_reuse
Generate a full sysctl config for your server
Values are starting points. Test on a staging machine and measure before and after.