Linux Increase Local Port Range

Linux Increase Local Port Range

Increase Local Port Range

In case your Linux server is opening a lot of of outgoing network connections, you might have to increase local port range. By default range is small.

How To Implement?

Edit the following file:

  vi /etc/sysctl.conf

And add:

  net.ipv4.ip_local_port_range = 20000 65535

Then run:

  sysctl -w net.ipv4.ip_local_port_range="20000 64000"

You can confirm the change by running the following:

  sysctl net.ipv4.ip_local_port_range

How To Revert?

Again edit:

  /etc/sysctl.conf

Remove this line:

  net.ipv4.ip_local_port_range = 20000 65535

Then run:

  sysctl -w net.ipv4.ip_local_port_range="32768    61000"

Confirm with:

  sysctl net.ipv4.ip_local_port_range

 

Materialize

The Real-Time Data Platform for Developers

Buy me a coffeeBuy me a coffee