AWS Certified Solutions Architect - Professional 2020

Sign Up Free or Log In to participate!

Who is assigning the Ephemeral Port Number: Server or Client?

Thank you for the “Please Do Not Throw Sausage Pizza Away” Mnemonic, I always have difficulty to remember the “session” layer, now I can remember the Sausage. 

By the way (Architect Pro 2019 Chapter 3 Networking Topic: Concept timeline 7:53), I am under the impression that the server assigns the Ephemeral Port Number and tells the Client. Not the client assigns a port number on the server. The client wouldn’t know which ephemeral port number is available on the server, if we allow the client to assign the port number, there is a risk of ports duplication. 

Of course, the client makes a request using the ephemeral port number that the server has told it to use. 

Open for comments.

Richard Wang

ok, the slide is correct. Ephemeral port is indeed on the client side.

cesare.sfondrini

The ephemeral port number is assigned by the operating system of the client.

cesare.sfondrini

no server involved. Obviously when the client initiates the TCP connection to the server it sends the ephemeral port it is going to use.

1 Answers

The side INITIATING a TCP/IP session dictates the port to receive data back on. So for example if you are SSH’ing to an EC2 instance, you initiate the connection to the EC2 instance by connecting to it on port 22, and your system tells it "send traffic back to me on this IP and Port" via information in the packet headers. It’s a bit more technical than this, but I hope the simple explanation clears up your question. You can google something like "how TCP connections work" for more info!

Richard Wang

Thanks! Client source ip: source port (ephemeral port, ie 52353) -> Server destination IP: destination port (well known port, ie 22)

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?