Hey what's up guys welcome to CertBros. In this video, we're going to be looking
at port numbers. So back to our trip through the tcp/ip model and remember
we're going through these layers as if we were sending data so top to bottom. In
the last video we looked at the layer 4 protocols TCP and UDP. Layer 4 is also
responsible for choosing port numbers and that's what we're going to look at
in a bit more detail. So why do we need port numbers? Well
let's say you live in this house, you will probably want to receive post here
So what do you do? You install a letterbox. Now when the postman comes
your letters can be put through that letterbox. The letterbox gives the Postal
Service access to your house and computers work in the same way. The post
in this case is the application data and the letterbox is the port number for
that application. It gives access to your computer for that service. Now instead of
a house it might be a server and this server could be running a mail, web or
any other service we want to send data to. Let's say we want to access the web
server. We type in the web address or URL of the site we want to visit
and the first thing the computer will do is convert this URL into an IP address
This is done by using DNS but we will cover that in another video
For now just know it converts that web address into an IP address. The computer
then sends the request to the webserver. But this server might not just be
hosting a web site using HTTP, it may also, be a mail server using SMTP or even
a file server using FTP. So how does the server know which application to send
the request to? Well these applications have something called a well known port
number assigned to them. HTTP is assigned port number 80
SMTP is assigned port number 25 and FTP is assigned port number 20 and 21
So because the port numbers are standard numbers all computers will know about
them. When we made our web request our computer knew we were trying to access a
HTTP site, so it added the destination port number of 80 to the TCP header
The computer will also choose a randomly generated source port number to receive
a reply. It's sent to the web servers IP address
and the well-known port for that service. The IP address and port number are often
written like this. It's the IP address a colon then the
destination port number. The server will receive this request
look at the destination port number realize the request is for the web
application and pass it to that application. The server would then
respond. This time the port numbers are reversed the destination port is now the
randomly generated one and the source port is our well-known port number 80
Again when we receive this response our computer looks at the port number.
The port number let's our computer know which application to send it to and in
this case our browser and even which tab of that browser to display it on. So the
IP address gets the data to the computer but it's the port number that gets the
data to the right application. Now this is a simplified version of how this
works just to give you an idea about port numbers what they're used for and
how they work. Ok so let's look at well-known port
numbers in some more detail. There are several port numbers that are
called well-known ports. These are common protocols that have been assigned port
numbers. Here is a very small list of some of the most common ones you'll find
we have things like HTTP port 80, HTTP port 443, SMTP port 25 and the list
goes on and on. It's important to learn these ports not only for the exam but
also for your everyday troubleshooting. You may be looking at a packet capture
and you'll need to know what type of traffic you're looking at. if you see
communication with an IP address on port 53 you'll know is DNS traffic. Now this
is by no means a complete list. No, in fact port numbers 0 through 1023
are well-known port numbers. Thankfully we only really need to know the more
common ones. There are also ports ranging from 1,024 to 49,151
these are registered ports that companies have registered. And finally we
have ports 49,152 through 65535 which are dynamically assigned ports
these are used to randomly generate unique port numbers for that local
computer that it can use as its source port. So to give you something to try at
home let's see these ports in action. If you
were to go and open a web browser and visit any website you want for example
certbros.com
and then open up powershell on your windows computer
If you then type netstat to show all the current connections. And -n to show
the numeric values. You would then see your computer's connections. You will see
the protocol being used, the local dress which means your
computer's address. Note that it shows a colon and a port number in this case
it's our source port. It also shows the foreign address which is the IP address
of the device you're connecting to. This also has the port number here it's our
destination and well-known port number of 80. Now most websites you see today
will be using HTTPS rather than HTTP which uses port number 443. HTTPS means
the traffic will be encrypted between you and the web server. Because at the
time of making this video the site was still in maintenance we're still using
HTTP, however by the time you see this it will likely be using HTTPS on 443
We can also manually change the port we connect to. For example if I type
certbros.com:80 it takes us to our maintenance page
But if instead I wanted to go to certbros.com:53
which is the port number for DNS the site can't be reached because the server
is not sending the request to that web application. In fact is trying to send
the request to a DNS service that isn't running on this web server
So that's it for port numbers go and take a look at your own connections and
port numbers being used. This video is part of our full CCNA course which can
be found in the description so please feel free to go and check that out. If
you like this video don't forget to Like comment and subscribe. The feedback from
you guys really does help the channel grow. Other than that, thank you for
watching