Time
57 minutes
Difficulty
Beginner
CEU/CPE
1

Video Transcription

00:01
Welcome back in this lesson. We're gonna take a look at some more utilities with advanced networking tools
00:09
and this. Listen, we're gonna learn about the utilities nets, that route and net S H.
00:16
Our first command up is Net Stat, which stands for network statistics. This is going to display active connections honor system as well as the remote system that we're connected to.
00:26
This is a good way to verify if our local system is listening on a specific port or not.
00:32
For example, a Web server has port 80 open. We want to see what connections might be connecting to it over that I, p and port
00:40
and you can see here in our screenshot we have the local address in the foreign address and also a state.
00:45
In this case, we have established in time Wait, not time. Weight means the client recognizes that the connection is active, but no one is currently listening on that I p import
00:55
well so have established, which means that thesis server has exchanged a TCP three way handshake with the other system. And there is a session currently established
01:04
another state we're going to see inside of our demo is listening, Which means thes server is listening on that port and ready to accept any connections.
01:15
Our next commanders route in this displays are local I p routing table on the current host.
01:19
What this means is it shows the routes that network traffic is going to take and which network gateway it's going to send it over.
01:27
This is useful as you can add your own static routes to control where network traffic is sent.
01:33
This allows you to direct traffic to specific network gateway if needed inside of your network.
01:41
Next up, we have NET S H, which stands for Network Shell. This is used to displaying configure different network communications settings on the local host.
01:49
It can do quite a few different things like take a look at your DNS or D A GP settings, and you can even control Windows firewall rules using this command line interface
02:00
in this. Listen, we're going to learn about how to reset our network stack and case it gets corrupted.
02:06
That does it for a slides. Let's jump back out to our workstation and take a look at our new utilities.
02:12
Here we are on server 01 and just a quick reminder. It's running our Web server, and our email server lets get started looking at net staffed by running the command on its own.
02:22
First, we'll come up. We'll see the protocol TCP our local address along with some ports followed by it.
02:29
The foreign address, which means thier remote system that's connected to it. And our state, just like we talked about the slides established means we've completed a TCP three way handshake and we have an active session running between the two systems and time. Weight means there's just no session established
02:45
here. At the top, you can see our local addressed over Port 80 and our foreign address of W S 01 which is our workstation.
02:52
So it looks like our workstation has a website open on our web server on this system. Next, let's take a look at net staff. Dash F. What this command will do is try to resolve the foreign address the i P address into an EFC udn. You can see our foreign address was already w eso won, and we have these other two I p addresses,
03:12
but it looks like they didn't resolve
03:13
so one thing we could do is use in its look up to see if we can resolve them or not.
03:17
And using the public Google DNS. We can see that these I p addresses don't resolve to n f ked in next. Let's bring back our nets that command and change dash F to dash A.
03:29
This is going to display all connections and listening ports on our system, and you can see we get a lot more information back. Let's go and scroll up real quick to the top of our list. And here with local address we see 0.0 dot 0.0. This just simply means that the computer is listening on all I P addresses that are configured on the host. In our case, we only have one.
03:49
But using this notation means we can listen for all of them.
03:52
And the 1st 1 we have up there is Colin 25 which again is for our email server. And the state is listening. So our email server is listening on all I P addresses of the server over port 25 inches, waiting for a connection to come in,
04:05
scroll down a little bit further we see are established connections that we just looked at previously. When running net stat on its own, you see the brackets with the two Collins in the middle. This is the local loop back I p v six address. We have some mawr. All I p address listening is here.
04:21
We have won 27.0 dot 0.1, which is our loop back address, and we have some actual I P V six addresses down here.
04:29
Let's rerun this command bullets at another option in, and this is going to display addresses and port numbers. And we really don't see much of a change here because there were no addresses to list on the foreign address side of it.
04:42
Finally, let's add one more option. Oh, and this is going to display the process i d. For each connection, we scroll back to the top. We see we have another column here on the far right P i. D. That stands for process i D. This is showing the process i d. That is running under each connection. So let's take our top one here.
04:59
We already mentioned that Colin, 25 is for email server
05:02
in our process. I d is 17 40. So if I right click down here on the task bar and go into task manager,
05:09
I go over to the details tab and I make sure I'm sorted by the process. I d.
05:14
I can scroll down, find 17 40 see it's the Internet Information Services, which that's the service I'm using in order to provide email services. So here, if you look at your active connections using that stat and you want to know what process is listening on a particular port in I p address,
05:30
you can add the process I d. And then go look at your task manager to see what services running on that port
05:35
an I P. Address.
05:39
One other thing you can do is if you're getting a lot of connection attempts back and you don't want to scroll through them.
05:44
What some people do is they'll take the command, tailpipe it over to the command, find string and put in a filter or text that they're looking for. Out of all that, let's see if we can find Port 25 hear this greatly reduces the results of our command. Our top line there shows our email server listening,
06:01
and we happen to catch another one here just because it's Colon 25 35.
06:05
Let's go and do this for Port 80 so we can look at active connections to our Web server. And again, this greatly reduces our results so we can look at them a little bit better. That does it for the Nets stat command on her server. Let's flip back over to our workstation and take a look at the rest of our utilities.
06:24
The next command we want to take a look at is Route, so we can view the routes our system has for sending traffic to different Gateway's First Let's start off by running route print.
06:34
Let's go back to the top here of our results.
06:38
First, we're gonna get back an interface list, and over here on the left is our interface. I d are tough. One i d six is our local network adapter, and then one is our loop back in her face.
06:48
Scroll down a little bit further. We have our I P V four round table.
06:51
We currently have several different active routes. The network destination is the network address of the Destination Network.
07:00
The top line here 0.0 dot 0.0 Pretty much means all other traffic or Internet traffic. You can see it goes to our default Gateway 1 72 1631 off of our only interface, and we also have a metric. This just determines which route takes precedence over other routes. Lower numbers
07:19
have higher priority,
07:21
then down here at the bottom, we also have a persistent route again. It's the exact same one we see above in our active routes,
07:29
and we also have an I. P. V six round table.
07:31
Let's say we want to add our own route because we want to force traffic to a specific network destination through a gateway that we specify. We used the route add command,
07:45
and first you specify the I P address of the network that you want to control traffic. For
07:51
next you put in the network mask of that destination network.
07:56
After that, you put the gateway that you want to route it through,
07:59
and finally you give it a metric to set the precedence.
08:03
And after that you also need to specify the interface. I D and if you remember earlier are only interface that we have had an idea of six
08:13
here again, we run into an issue where this requires elevation. So let me copy our command.
08:20
Let's open up an admin command prompt.
08:24
Like to clear out the screen here a little bit. Let's paste in our route. Add command
08:28
and it was successful. Let's run route print again and view our new static entry.
08:33
We scroll back up,
08:35
we can see our new entry right here. About half way down the list.
08:41
We have our network destination, the network mask. What gateway we were in it to go out to and our metric.
08:46
Now, if you notice we have active routes up here and persistent routes with this route, we just added, If we were to reboot the system and run route print again, we would no longer see this because it's not gonna be a persistent route through reboots.
09:01
So what we need to do is rerun our command and make sure we make it as persistent. So it shows up down here at the bottom under persistent routes.
09:07
So first, let's go back and delete our entry.
09:11
We just run the route, delete command and specify the destination network.
09:16
And I'm going to up arrow to our previous command.
09:20
Go back to the beginning.
09:20
An ad dash P.
09:22
Let's round route print again.
09:26
If we go back up,
09:28
we could look in our active routes. It shouldn't be there, but it's now down here listed under our persistent routes.
09:33
So one of the reasons you might want to use this command is if you have a server with multiple network interfaces. Typically you only want one of those network interfaces to have a gateway address or a default gateway specified for it.
09:48
If you want a traffic to rout out one of the other network interfaces, this is where you would do it. You specify the network destination the gateway
09:58
and assign it to that interface. So goes out that network heart,
10:01
and this is also a good troubleshooting method. If you're seeing traffic being routed in an unexpected way, maybe using the trace route command, you can check your route table here just by Rennie Route print,
10:13
or if you temporarily need to sin traffic to another destination, add your own static route.
10:18
What's going to clear the screen.
10:22
Next. Let's take a look at that S H, which stands for our network show.
10:26
First, I'm going to run. That s H ford slash and a question mark to view the help text for it.
10:31
Like I mentioned, the net s H command does a lot of different things. You can work with your d HCP or DNS client or even managed really local windows firewall.
10:41
But the things I want to look at here is sometimes you run into issues where what pages aren't loading, even if you're on the network. Or maybe you just recovered from a network or malware that was infected on your system.
10:52
But your network settings or your network stack has been corrupted.
10:56
One of the command you can run his net S h wind sock reset.
11:01
And if you notice I stayed in my admin command prompt here, cause this command does require elevation.
11:07
Once that command is completed, you do have to restart the computer to complete the reset. I'm not gonna do that now, since we're not running to the issues, just know that's gonna be a requirement.
11:16
So this is a quick way is if you're on the network and everything looks good, but you're having issues. Like I said, loading a Web page or being able to access some services. This is a good troubleshooting, Commander Brown. And to get your system to reboot and see if that results the issue
11:31
that does it for our demo. Let's jump back to the slides and wrap this up.
11:37
All done with our demo again. Let's end with a quick quiz question.
11:41
What command and options can be used to view open connections in their associative process? I d
11:48
This is gonna be done through our nets that command using Dash A and O at the same time.
11:54
Then remember, you can use task manager to view the process i d and match it up with what service is being used on that I p import.
12:03
That is it for this lesson where we looked at viewing open ports and connections, using nets that command
12:09
viewing and modifying our static routes, using the route command
12:13
and then resetting our network stack with the net S H command
12:16
coming up. Next, we're going to take a look at how we can actually capture network traffic for analysis.
12:22
See you in the next episode.

Up Next

Network Troubleshooting and Tools

In this course, we will learn basic network troubleshooting using command line tools in a Windows environment. We will learn to verify local network configuration and test connectivity from our local system to other network resources.

Instructed By

Instructor Profile Image
Jeff Brown
Instructor