Which is the effective ephemeral port range in Linux 2.6 for this set up?

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?

Assuming that you did not just change the value in /etc/sysctl.conf and have not rebooted, the range in /proc/sys/net/ipv4/ip_local_port_range applies.

1 Like

I set parameters in both way given in question . Moreover my startup script /etc/rc.local is taking care parameters of proc file system . So after I reboot what will be the effective range?

Should be the values in /etc/sysctl.conf

sysctl -A | grep net.ipv4.ip_local_port_range

will give effective port range at any moment.

After reboot if we execute sysctl -p /etc/sysctl.conf system update kernel parameter net.ipv4.ip_local_port_range from /etc/sysctrl.conf file

Simpler to just use

cat /proc/sys/net/ipv4/ip_local_port_range 

Unless you have modified the contents of /etc/sysctl.conf, this command should be unnecessary as the reboot causes /etc/sysctl.conf to be read. Also the default file is /etc/sysctl.conf, so sufficient to use

sysctl -p