I have a server running mysql, ssh and other services. I want to see the range for ephemeral ports available for the OS running:
cat /proc/sys/net/ipv4/ip_local_port_range
which returns 32768 - 61000. When I run
sudo netstat -anp
I get in the foreign addresses, many ips and also ports outside the range stated before. Example:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 10.251.1.62:3306 207.81.181.89:63192 ESTABLISHED 1483/mysqld
Which looks to me that my server is assigning port 63192 to the remote host, which is not it's allocated range. How is this possible? am I not looking the ephemeral ports in the right place? am I not understanding properly the output of netstat? Am I not understanding how ephemeral ports work at all? Thanks.