Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view and edit the ephemeral port range on Linux?

In my Linux system ephemeral port range is showing different ranges as follows

$ cat /proc/sys/net/ipv4/ip_local_port_range 
32768  61000 

cat /etc/sysctl.conf | grep net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 9000 65500

Which will be the effective ephemeral port range in my system?

like image 974
Steephen Avatar asked Feb 17 '15 23:02

Steephen


People also ask

How are ephemeral ports assigned Linux?

It is created from a set range of port numbers by the IP software and used as an end client's port assignment in direct communication with a well-known port used by a server.


1 Answers

Following command will list the ephemeral port range in Linux system

sysctl net.ipv4.ip_local_port_range 

If we don't want to reboot, after editing /etc/sysctl.conf file if we execute following command it will be effective.

sysctl -p /etc/sysctl.conf .

The truth of the matter of effective range is output of

sysctl net.ipv4.ip_local_port_range 

as mentioned by eckes in comment.

like image 103
Steephen Avatar answered Sep 30 '22 06:09

Steephen