In this section, we'll be discussing a very basic networking command called netstat. So what exactly is netstat? netstat displays listening ports on your PC. Now that brings up another question in itself. What exactly are listening ports? Well, let's go ahead and take a look at our drive board and see if we get a better understanding before we dive into command netstat.
So let's just say you have two individuals in an office that wants to communicate via email. One person wants to send an email the other one wants to receive the email. The other individual wants to reply to the email and the other individual wants to receive the reply email. Seems pretty nice. Simple when you're in the act, but basically your PC communicates this emailing language over something called ports. This is basically how your, how your computer communicates with another PC, over the internet on a network, different things like that.
Now, in order for these ports to function properly, they have to be open or they have to be listening. So basically in a situation like this, both PCs have to have certain ports open over the Internet to receive this email. These are just a few. Let's go ahead and take a look at the command netstat. In my PC, I'm going to click Start. And in the search programs and files box, I'm going to type cmd want to right click and hit Run as Administrator As we can see we have an elevated command prompt.
Want to change the color? Let's go ahead and type the command netstat in et St 18 forward slash question mark. And let's see what we get. So we see the command netstat, displays, protocols, statistics and current TCP IP network connections. Basically, connections that are made and connections that are listening. So we have different switches here dash, a EF, things like that.
Now, in the corporate world, or any basic networking with netstat, you need to go ahead and to start off is to display all connections and listening ports. Let's go ahead and run that command. I'm going to type in et sta t dash a and hit enter. So we see here on RP See, we have ports like 13544569, different things like that this listening, basically for connection and ready to accept that connection. Now, why exactly are ports themselves important? Well, let's go ahead and take a look at some common ports over the internet.
I kind of have a web page book here. So we can go ahead and look at this. Hey, copy. I'm going to open Internet Explorer. I'm going to paste. Now, this is a list of common networking port numbers, we're going to see it figure out why port numbers are exactly important to us.
As you can see here we have Port 22 SSH 23 telnet 53 domain name server. Port 80 hypertext transfer protocol. GTP as you can see here is the web page, we have an HTTP port open. So the reason why ports or important on your particular PC is because for the ports are needed for network connectivity. So if I was to go in and basically disconnect port or shut down for ad, I would probably no longer be able to make internet connections because my PC is now no longer accepting listening requests from outside networks. Now another command that we want to run with netstat is the dash or we're going to type netstat dash R. Let's go up actually, and see what exactly the dash or is.
So we see dash or displays the routing table. Now what exactly is a routing table? Well, let's go ahead and hit enter. See what we get back. Now with the netstat dash, our command, the ipv4 routing table appears. We have the network destination, the subnet mask, default gateway, and the interface.
Now basically a routing table is basically what your PC and router stores for common connectivity. So let's just say from my PC, normally I connect to another PC on the same network. your PC basically is going to save whatever the fastest route from your PC to your destination that it discovered. And it's going to save that in its routing table. Another way to look at this is just imagine when you leave for work in the morning. On average, the average person has about probably three different ways they can get to work.
So that's your routing table. So if one lane doesn't work, you have a backup or If the roads have flooded, you know another highway that you can take that's your default routing table, your PC does the same thing is going to store the fastest routes that you took to some destinations. So I hope you guys enjoyed this course. This is the very basic introduction to netstat. We did the dash a command that lists all connections and listening ports. We went over what exactly ports do between your PC and another and also we went over the routing table.
Hope you guys enjoyed this course. I will see you again in the next one.