Next up, we're going to take a look at network interface
card, or NIC, issues. We might find our performance seems to
be slow on a particular server.
But if we check the network interface card,
we might find that we're dropping packets. If we're dropping packets,
that means that those packets are probably going to have to be
resent, affecting our network performance. Now it might be the
network interface card or it might be a port on a hub or a switch,
but even so, we have to investigate it. When we want to investigate
it on our Linux system, we can use our good friend, the ip command.
If we use ip ‑s for statistics, we can go through and take a look at
our link and show for a particular network interface.
We'll be able to see then how many packets we are receiving,
the throughput that we've got on our network card, as
well as showing any dropped packets.
We can also look in the raw information, and the file related
to that would be /proc/net/dev. It might be easier though to
look at it with the column command.
You might not have come across this before, but column ‑t allows us to
separate with tabs each of the separate fields in the file.
So we're looking at the same file, but just looking at it
with column rather than the cat command. But why don't we
go out to the command line?
I emphasize that, we, so we can learn a little bit more about how we
can detect issues with our network interface card.
So we're going to check the statistics from the NIC and view the
raw data from the proc directory structure. Now just for ease, I'm
staying on my Vagrant system, but it doesn't really matter. If I
run the ip link command,
we're going to be able to see the network cards that I've got.
So we've got the loopback, the enp0s3, and enp0s8. If we want to go
through and take a look at, let's say, the S3 network card,
that's where I would have been connected to for the moment using
the SSH session. We can go through and look at ip, and then ‑s
for statistics, and then link show enp0s3. When we go through
and take a look at this,
then we can see then the bytes, the packets that we've been
receiving and we're transmitting. If I go through and look at this
again, because we're using SSH, we're constantly transmitting on
this, so the figure should be going up.
We see it's not going up hugely.
So, it is related just to my session, and nobody else is
connected to the system at the moment.
But when we go through, we're not getting any errors or
dropped packets or packets that we've had to ask to be
resent because they've been missed.
If we want to look at the raw data,
we can do so, and that's going to be in our proc directory structure, so cat
/proc/net and then /dev. And we can see then that we get the information
through with cat, and this is just a space‑separated file. On my display,
that actually works out quite well. But another tool that we can use to space
things out a little bit more, but it's going to not work so much on my display,
but it's useful for you guys to try it is column ‑t, so put some tabs in.
Escape and dot, remember, brings up that last argument,
so it just then puts a tab in between each of the columns to separate it out,
which can make it more readable,
but not when I'm using a larger font to help display information so you can
read it on different types of devices. But there you go,
a quick and easy way we can use our good friend ip to go through and
understand if we are receiving too many packets or if we're dropping or erroring on packets causing network retransmissions.