Search code examples
linuxportslisten

Can I force some ports for listening only(mean servermdoe)


In linux is there a way to tell the system that never give a port for client connection, but instead allocate it only for requests for listening(server).

That is, given a port P, If a proc wants to connect to host X then dont give the port P, give some other port. But if a proc wants to listen on port P then its OK?


Solution

  • /proc/sys/net/ipv4/ip_local_port_range contains the only range of IPv4 ports that the system will use to connect with.