Site icon New Generation Enterprise Linux

Stop your Linux box from being stingy with ephemeral ports

Performance Tuning & Kernel Parameters (Sysctl)

Stop your Linux box from being stingy with ephemeral ports

đź§© The Challenge

You’re running a high-traffic API or a busy database proxy, and suddenly your logs are screaming about connection timeouts. It turns out your server has run out of ports to talk to the backend, leaving you stuck while the kernel holds on to dead connections.

đź’ˇ The Fix

Crank up the ephemeral port range in sysctl to give your system more breathing room for outbound requests. This prevents those pesky “cannot assign requested address” errors when things get spicy.

sysctl -w net.ipv4.ip_local_port_range="1024 65535"

⚙️ Why It Works

By default, many distributions keep this range tiny, but pushing it near the top of the 65k limit lets you handle way more concurrent backend connections without tripping over your own feet. You’ll want to make this change permanent in /etc/sysctl.d/99-networking.conf so you don’t lose it after a reboot.

🚀 Pro-Tip: Check your actual usage with ss -ant | grep ^TIME-WAIT | wc -l before you touch the limits.

Linux Tips & Tricks | © ngelinux.com | 10/13/2026

0 0 votes
Article Rating
Exit mobile version