Jump to Navigation

183 - Port Range in Linux

There is a port range rule in Linux. Most of port number is registered in /etc/service.
Even though you register it in /etc/service, no restriction agaist other programs and applications.

0 - 1023 : Well Known Ports
1024 - 49151 : Registered Ports
49152 - 65535 : Private service, Physical port

* Check the local port range.

$ cat /proc/sys/net/ipv4/ip_local_port_range
1024    65000
$ sysctl net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 1024     65000

The first number is the first local port allowed for TCP and UDP traffic on the server,
the second is the last local port number. For high-usage systems you may change
its default parameters.

* Set new local port range.

# echo 1024 65535 > /proc/sys/net/ipv4/ip_local_port_range
# sysctl -w net.ipv4.ip_local_port_range="1024 64000"

 

 

 

 



Main menu 2

Story | by Dr. Radut