In this walkthrough, we're going to go over a few
of the network services utilities that Linux provides
in order to troubleshoot the network.
So in particular, we're going to go over the ss,
or the socket state command, the netcat command,
and also one of my favorites, the TCP dump.
So first let's just see what our current address is.
Now we look at enp0s8.
That's my second ethernet NIC I'm currently using.
And we'll see the IP address for that's 10.0.3.15.
Now, just to note
if you were ever to see something like 169.254,
that's letting you know that there's an issue
with the DHCP server.
And we're not able to issue any addresses at the time.
All right, let's go ahead
and try this socket state command really quick.
So we're going to do socket state.
We're going to do listen.
That's what that option stands for.
We want to go to the less command
cause it gives out a lot of information.
So we want to condense that for us.
Okay.
So it's going to pull up pretty much a socket.
In a socket it's nothing more than a combination
of an IP address and a port.
So if we see these names, these network names,
with the different ports that's associated with them
that's what a socket is.
An address associated with a port.
So we scroll down, we can see all
of the services that are listening currently on our device.
Okay.
I'm going to quit out of this.
Now next we're going to actually try to connect
to our port 21 on our local host.
This is to test out the network connection.
Now it should give us an error
because we have not opened that up.
Okay. Connection refused.
That's exactly what we should have got.
Remember the nc stands for the netcat command.
Again, this is another network utility tool that we can use
to troubleshoot our system.
All right, next I'm going to check our partner's connection,
and it should be listening on port 22
which is for the SSH connections that we made earlier.
So let's try to connect to our partner's
server02 and do port 22.
Okay.
So what this response has given us
let us know that we've opened an open SSA session
and we have a good connection.
So going control C out of that
and we don't need to do anything further.
Again, that's just the test to make sure
that the connection was open.
Next we're going to test the domain name resolution.
So we can use this host command.
And this is just to resolve addresses for DNS.
Okay, so we're going to do comptia.
Okay, we see it resolved for us comptia has two IP addresses
associated with it as well
as two IPv6 IP addresses as well.
So again it's a quick way to test the DNS servers
and make sure that they're resolving properly.
And last but not at least, one of my favorite commands is
going to be the TCP dump command.
Now we're going to set this to be listening
to one of my ethernet NICs.
Okay, so we have that going.
Now we're going to open up another terminal and ping
and we're going to see what the results are.
Going to set it for four count.
Okay.
All right let's switch back over and see what we got.
Now we see this network utility tool.
It pretty much monitors our network and gives us information
about anything that's going
in and out of that NIC.
And we see we have a series of ARP requests
which stands for Address Resolution Protocol.
And that's to resolve the MAC address
from an IP address because on the local area network
everything is sent via MAC address.
And now if you look down here, we see that ICMP Protocol.
Now again, that's what's going to be the protocol that monitors
or that creates ping.
And we can see that we sent the request.
Got a reply request reply
and a little bit more information.
So everything that's going in and out of that NIC,
it's going to record it for us.
So it gives us more in-depth troubleshooting for things.
Okay, so we just went over a few tools just
to give us a good view of how our network is operating.
One of my favorite ones, TCP dump,
this is a good network capturing tool
to allow us to see what's going
on in and the outside of our NIC.
Let's not forget about the netcap
and the socket state command.
And I'll see you in the next lesson.