Hey guys and welcome back. Now what I want to talk to you about is how we can actually
use tools to monitor our network IO. One of the primary tools that we want to use in order
to monitor such a thing is the netstat command. So let's go and check this out then. So what
I will do is I will open up a terminal right here. Okay so if I do man netstat we'll actually
see the manual page. It's going to allow us to print network connections as well as things
such as routing tables, interface statistics and others. So this command really is very
useful. Now one of the best switches to use when using the netstat command is the dash s option.
This is going to give you a nice summary of network statistics based on a particular protocol. So
what I will do here is I'll say netstat dash s and check this out. We can actually see per
protocol our network statistics. We can see our IP packets right here. The amount received,
the amount forwarding, ICMP which we use for our ping messages, TCP, UDP so on so forth. So think
about this if you happen to be maybe experiencing some poor connections with respect to video,
well you might know is that video just like voice is going to use UDP. So straight away by using
netstat dash s we can target right in and have a look at this then we can actually see you know
are our UDP packets being received, are they being sent, are we receiving a lot of packet errors.
So being able to use this command and neatly get a summary of the particular statistics such as the
amount of packets received and the amount of errors received or sent and being able to parse out this
information per protocol this can be a really invaluable troubleshooting command. Now we also
have additional switches of course that we can use. Let's clear the screen. Say for example we can
say netstat dash l so let's scroll on up we can see all of these sockets in the state of listen.
So if we happen to be having a server that should be accepting connections one of the ways we could
check that it actually is listening for connections and the event that maybe we have connectivity
issues is to log in and to check that that server does in fact or rather is in fact should I say
listening for a particular connection so this filter right here the netstat dash l this is going
to give us that information but again we can go even further yet again as we can see here we can see
we are listening for UDP connections if I wanted to filter just for let's say maybe TCP connections
I could actually change this filter I could actually say dash LT to see TCP connections that are
listening so if I hit enter now notice on the left hand side the protocol is only TCP based
connections as opposed to UDP and of course we can actually invert that logic by saying LU and we
just see the UDP connections that happen to be listening. Now one cool thing we can actually do
also is to say netstat dash C what this is going to do this is going to allow us to get real time
information and we'll actually see as we saw there with the screen changing continual updates of
the netstat display so when you want to actively be seeing what is happening right now this is going
to give you a window into what is actually traversing your network so a really really valuable tool.
Now if you happen to experience some type of network connectivity issue maybe you can't reach a
particular server or you can't reach the internet one of the commands you can do is say netstat dash
R which is actually going to allow you to see your routing table so if you happen to have some type
of error configured we don't have a gateway so that we actually can't reach external networks
such as the internet this netstat dash R command will give you an insight into that by giving you
the routing table so you can actually check that these entries do exist and are correctly configured.
So the netstat command really is one of the main commands that I would use in order to monitor and
troubleshoot any network issues but as always I would recommend you go through the man page and
explore the different options that this command has available to us and really familiarize yourself
with them. Ok docks I hope this has been informative for you and I'd like to thank you for viewing.