How to Network Testing and Verification with CLI Commands
Hello everyone. We are here to do network testing and
verification. Not using the GUI, we're going to be using the CLI, the Command
Line Interface inside of our Windows 10 box. Now to do it, we can get there a
couple of different ways. It really starts with start. If you wanted to, you
could type in "command prompt," and that would take you pretty
quickly right to it, or we can use start and take a longer route, typing in
"run," and opening a run box, or I can use Windows R to get to our
run box, or I can right click on that start button and click on run, and get a
run box. From there, in the run box, we would type in "cmd" like cat,
mouse, dog, cmd, and click okay. And from there it opens up our command prompt.
Going to resize it a little bit for our video purpose. That's looking great.
And now what I'm going to do, just for more room of typing, I'm going to type
"cd" followed by a back slash, and hit enter. And this'll just take
my prompt back to the directory of, root directory, the C drive. This is just
for purpose of having more room to type. So I'm going to use the first network
testing command I wanted, and that is ipconfig. I'm going to enter the ipconfig
command. We get some basic info here. I get the IP address of the end device
I'm on, which is my user computer, which is 192.168.100.96. I get the subnet
mask, which talks about the network size, how many IPs exist on this network. I
have the default gateway, which is the routers IP address that my machine is
going to leave the local network. Now this is all fine and great, but if I want
to see more info, like what DNS server is my user actually utilizing in order
to go out to the web and search names. Well to get that type of info, and also
to get info about my MAC address of my device, I would use the command
ipconfig, space, forward slash, all. And when I hit enter, it's going to be a
larger output. So here's the original command at the top, and here's my output.
The name of my device is displayed. The MAC address, which is known as the
physical address, of my machine is also displayed. Below that, we get more info
as well, such as here is our basic of info we saw before. Link local IPv6, my
IPv4 address, subnet mask, default gateway, but check it out, we even get the
listing for our DNS server. Who we're going to ask for information about a name
to be translated to an IP on the web. So we see a lot more info here with our
ipconfig. Now let's take this onward, and let's talk about one of our network
testing tools that we like to bring up, and that's going to be PING. PING
stands for Packet Internet Network Groper, and the idea of PING is we want to
reach out and touch something. So what I can do it type the command PING, and I
can follow it by a target, and that target can be a cisco target like
208.67.220.220., and I'll hit enter, and my machine is going to toss out ICMP
echo requests, and these are four, that's how windows does it, four echo
requests. And when they go out, I get four echo replies back. I said four
"are you there at this address," and I got four responses, "yes,
I'm there at that address." So I can see that I have reachability. Now
this just tests layer three, we're regarding the idea of the network layer of
the OSI model, and what this is referring to is I can reach something by
targeting an IP address. But what if I want to make sure that my PC can
actually reach somebody by targeting a web address? What if I said, for
example, this. Ping www.cisco.com. By doing this, I'm telling my computer to
reach out and hit the name cisco.com, which means step one, when I do this, my
PC is actually going to the DNS server that we've seen above, and saying
"DNS server, who is cisco.com?" Cisco.com is being translated to an
IP address, and then my PC goes out and pings that IP address. We're getting
responses back from that IP address that my PC found was 104.66.32.105. You can
see here that we've sent four echo requests, and we've got four echo replies.
Nothing was lost, we have 100% success. So that's PING, and that's ipconfig,
and for both of these, you can use your help modifier in command line, and
that's again going to be your slash followed by a question mark in order to be
able to view other options that exist because there's many of them. And we can
take a long time going through those, but we're not going to do that. Now, what
if you want to just test DNS? To test DNS, there's a command called nslookup,
and following the command nslookup, you could just hit enter and get into a DNS
lookup mode, or we could just follow it with a target. For example, I can
follow nslookup with www.cisco.com. And if I hit enter, my computer polls and
says "hey, DNS server 1.1.1.1, who is www.cisco.com?" And the
response we get back is cisco.com is the IPv6 address you've seen listed here,
or it's the IPv4 address you see listed here. Now you can try a couple of
different targets and see what comes back. Not all targets will come back with
an IPv6 address. Some websites have not made that transition to dual stack,
which is IPv4 and IPv6 running at the same time. So this is all fun and cool,
but this is how you can check to see if you actually have successful DNS
lookups to a website. Now, on top of all this, there's another command that we
like to bring up, and this one is called netstat, and this is a personal
favorite of mine. There's a lot of options for netstat, so make sure you use
the help command to really view them all. With netstat, what we can do here is
take a look at open ports and connections from our machine right now, like what
is our machine connecting to right now on the network. Now, following netstat,
there's a couple of different modifiers and switches like to use. The main one
I do is hyphen b. With hyphen b, this is going to give us the actual process of
our machine that is opening this connection. Also, I use hyphen n, because I
don't want to have to wait for a DNS main resolution for each individual
session my computer has at this moment. I'll go ahead and click enter. Now,
boom, it failed on you, why? Because when I created this command prompt, I
created it from the user account of student. This requires elevation. This is a
system command that I need to open up another command prompt, and be able to
use permission of administrator. Let me show you. I'll click start, I'll type
"command prompt," and I'm going to use the run as administrator
option, or I could've just right clicked on it and did run as administrator.
When my new window opens up, yes I want access, and here we are with the
default directory of Windows system 32. Again, I'm just going to back up using
my cd back slash, and I'll do it again. Netstat, I then follow it by hyphen b
and hyphen n. When I click enter this time, take a look at this. Based off of
the services and protocols and applications running on my machine, I can take a
look and see my PC's IP address and port number, known as a socket, source,
reaching out to this destination target and port number, that destination
socket, and then what service is being utilized on my computer. Now if you had
other applications open inside of here, there's Microsoft photos.exe, there's a
connection out, there's this one that's connection out, you can read through
all these different items. And we don't have any name translation, because I
used hyphen n as a switch, and here we can see these number one dot exe's and
other items, because these are based off of the hyphen b switch. So have some
fun with it, and use your tools to troubleshoot your connections, view what's
occurring, and verify what your machine is connecting out to on the web. Again,
you can spend a lot of time with these commands and switches, so please make
sure that you use that help command. For example, netstat, space, forward,
slash, question mark. Then I hit enter. We see all the switches and possibilities
for using netstat. Utilize these commands, become that IT professional,
practice, and you will become awesome. Thanks for watching.
0 comments:
Post a Comment