Pages

Linux ephemeral port range for TCP/UDP connections over IPv4

The range of ephemeral ports a client program can use (unless otherwise specified by the program) on modern Linux OS distributions by default is from 32768 till 61000 (for systems with more than 128 MB RAM) and from 1024 till 4999 (or even less) for systems with less than 128MB of RAM. This range is defined in the kernel parameter /proc/sys/net/ipv4/ip_local_port_range and it affects both TCP as well as UDP client connections.
Should there will be a need to change this range to extend the range(for example setting the lowest port number to 15000) we cal use:
echo "15000 61000" > /proc/sys/net/ipv4/ip_local_port_range

To make this change persistent after reboots, we can use sysctl.
Edit /etc/sysctl.conf and append the entry:

net.ipv4.ip_local_port_range = 15000 61000

then, for the change to take effect force sysctl to reread the settings in /etc/sysctl.conf, run as root:

#sysctl -p

Please see this post for tunning the ephemeral port range on HP-UX.

1 comment:

Ella Smith said...

I think this is a really good article. You make this information interesting and engaging. You give readers a lot to think about and I appreciate that kind of writing about
creditcardgenerator