Concepts / Ports, sockets and UDP

Ports, sockets and UDP

Ephemeral port

Also called source port, client port

The temporary port a client's kernel picks for each outgoing connection.

The client's port is temporary, the server's is fixed
The client's port is temporary, the server's is fixed

For each new connection the client's kernel picks a free source port from a range. That is why two tabs can talk to the same server port at once without their replies being mixed up.

An ephemeral port is the temporary source port a client's kernel picks for each outgoing connection, from a range (32768 to 60999 on Linux). The server's port stays fixed; the differing client ports are what let one server port hold thousands of connections, and one client open many connections to the same server. The port is free for reuse once its connection is gone.

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab