Ephemeral ports are temporary source ports assigned by a client machine to manage individual TCP connections with remote hosts. This topic covers how browsers assign, reuse, and create new ephemeral ports depending on the application and connection context.
Ephemeral Ports
An ephemeral port on a machine is a source port. This demo laptop will create an ephemeral port to communicate and establish a connection with another machine. Sometimes it can reuse those connections, while other times it will establish a new connection.
First of all, we're going to start by monitoring this Ethernet connection. So I get the Ethernet connection going, and I'm going to generate some web traffic. I'll bring up a browser and I'm going to go to that Demo Pi site that we have.
In this case right here we've got this request — it's making an HTTP request. So we see now that 60,959 is the request that it makes. It's using this TCP connection, 60,959.
Now what I'm going to do is open up a second tab on here. I'm going to go to the same site, but in this case I'm going to go to index2.html. This is another web page that we had created, so I'm going to go to that. It generates some more traffic.
Let's see what the new request is going to. So here is the request I just made. It's another port that it's using with it, and so that is a different port — although I believe if we look back here, it was established way back here, so 60,960. Essentially it already made this connection and it's just reusing this connection. So Chrome has some capability of keeping track of these conversations and using that same connection.
But now let's take a look and see what happens if we bring up a new browser. I'm going to bring up Edge in this case, and we are going to go to the same website and generate some traffic there, and we'll see what it compares to. So this is 60,959, 60,960. We just went to a new page here using Edge, so let's find that. Here's the HTTP, here's the request for that, and we see that it's 61,011.
So it is a different port. It's keeping track — it's a different ephemeral port, keeping track of this conversation on a different port in this case. Chrome is using essentially the same port that it had already established, versus when we bring up another browser: now it's making a new connection and establishing a different TCP connection for that communication.
So we see that there is some capability of keeping track of these conversations on an application level, but between applications then perhaps we need to establish a new TCP connection to get that information.
So that is ephemeral ports. You can see these ephemeral ports that are being randomly created on the demo laptop, or our source machine.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →