< Return to Video

Network Monitoring Tools! (CompTIA Linux+ Objective 1.5.3)

  • 0:00 - 0:04
    Hey, everybody. Shawn Powers here. It is 5:15
  • 0:04 - 0:06
    in the evening. I just finished work.
  • 0:06 - 0:10
    I have another appointment at 6:00, but it's been too long. So we're doing
  • 0:10 - 0:12
    this video, and we're going to do it right
  • 0:12 - 0:15
    now. Linux Plus, the next section.
  • 0:15 - 0:16
    Before we get started, though, I want to
  • 0:16 - 0:22
    take a minute to thank DJ Eric Santos, who is the newest top-tier Patreon
  • 0:22 - 0:24
    supporter of this channel, and of me, and
  • 0:24 - 0:29
    all the things I do, and I just cannot thank you enough. It--it just humbles
  • 0:29 - 0:31
    me that people are willing to spend
  • 0:31 - 0:33
    their actual money to support what I'm
  • 0:33 - 0:37
    doing here. So thank you. And top tier--it--
  • 0:37 - 0:41
    I had to actually look to see what all the benefits were because you are my
  • 0:41 - 0:44
    second top-tier supporter, and I didn't
  • 0:44 - 0:45
    even remember what all the benefits were.
  • 0:45 - 0:51
    So thank you, and I will get your welcome basket boxed up and sent out to
  • 0:51 - 0:57
    you. And, without further ado, let's get on to this Linux Plus objective 1.5.3.
  • 0:57 - 1:01
    Now, in this video, we're looking at network monitoring tools.
  • 1:01 - 1:03
    We're going to look at TCPdump and Wireshark
  • 1:03 - 1:06
    or TShark. And then these tools--we
  • 1:06 - 1:09
    looked at some of these tools before--netstat and ping. We're going to look
  • 1:09 - 1:14
    at traceroute and MTR, which is My Traceroute, a newer tool. But I do have
  • 1:14 - 1:19
    to mention, when we're talking about TCPdump and Wireshark, people tend to get
  • 1:19 - 1:22
    very, very opinionated--a lot like my dogs,
  • 1:22 - 1:24
    apparently, who are barking about something. You'll probably hear them
  • 1:24 - 1:26
    through this whole video. I can't seem to
  • 1:26 - 1:29
    get them to quiet down. But this video is
  • 1:29 - 1:33
    not like a--a training video on Wireshark.
  • 1:33 - 1:36
    There are entire courses devoted to
  • 1:36 - 1:38
    Wireshark and TCPdump. I'm just going to
  • 1:38 - 1:40
    show you what they do, how to do a couple of
  • 1:40 - 1:43
    very simple things with them so that we
  • 1:43 - 1:48
    can understand it as a tool to meet the requirements of the Linux Plus
  • 1:48 - 1:52
    objectives, but also just so you get a feel for what's possible. This is not
  • 1:52 - 1:54
    going to be a complete and thorough
  • 1:54 - 1:58
    course on TCPdump, Wireshark, TShark, that sort of a thing. This is just to
  • 1:58 - 2:03
    give you a feel for what you can do with some network monitoring tools.
  • 2:03 - 2:05
    Before we get into those particular tools, I want
  • 2:05 - 2:06
    to talk about some of the things that
  • 2:06 - 2:08
    we've already looked at and share some
  • 2:08 - 2:10
    similar properties. So, ping. You've seen
  • 2:10 - 2:12
    me use ping all the time and basically,
  • 2:12 - 2:17
    we just do, like, ping google.com. I mean, this is doing a lot of things.
  • 2:17 - 2:19
    It's doing a DNS lookup for the IP address, and then
  • 2:19 - 2:23
    it's sending out an ICMP packet to the
  • 2:23 - 2:26
    IP address that it finds. Now, that ICMP
  • 2:26 - 2:28
    packet goes there and then it responds
  • 2:28 - 2:33
    with another ICMP packet--an ACK reply. We're not going to go into the
  • 2:33 - 2:36
    nitty-gritty of networking. But basically,
  • 2:36 - 2:43
    this sends out an ICMP--which is not TCP, it is not UDP. It's ICMP, which is a
  • 2:43 - 2:49
    different type of traffic specifically for making connections work.
  • 2:49 - 2:52
    And just as a really brief rant: there are a lot
  • 2:52 - 2:58
    of security experts who believe that blocking ICMP at the firewall is really
  • 2:58 - 3:04
    wise, or not responding to ICMP traffic is a way to stay more secure.
  • 3:04 - 3:08
    Now, maybe there are some security reasons to
  • 3:08 - 3:16
    do that. I don't think that the security benefits it might provide are
  • 3:16 - 3:21
    worth breaking how the Internet is designed to work. ICMP is a type of
  • 3:21 - 3:22
    traffic that regulates how the Internet
  • 3:22 - 3:24
    works. It makes things work better.
  • 3:24 - 3:27
    So I'm personally not a fan of blocking ICMP
  • 3:27 - 3:31
    traffic like pings, but I don't want to get into an argument about it.
  • 3:31 - 3:33
    But just know--if something doesn't reply to
  • 3:33 - 3:39
    a ping, it's probably somebody who decided that blocking ICMP traffic is a
  • 3:39 - 3:42
    way to secure their place--their, you
  • 3:42 - 3:44
    know, their systems. And so you might have
  • 3:44 - 3:46
    to do something else, which we'll talk
  • 3:46 - 3:47
    about in a second. Anyway, this sends out
  • 3:47 - 3:50
    that ICMP traffic and then it responds
  • 3:50 - 3:52
    and tells you how long it took to
  • 3:52 - 3:55
    respond. And you can see this--it's very valuable information,
  • 3:55 - 3:56
    especially when you're doing network
  • 3:56 - 3:59
    troubleshooting. Now, one of the things
  • 3:59 - 4:06
    that ping does, and ICMP allows you to do, is do a timeout. Like, if it only
  • 4:06 - 4:08
    goes a certain number of hops--like, if it
  • 4:08 - 4:10
    takes more than this many hops, like going from this router to that router to
  • 4:10 - 4:13
    this router to that router--it will fail.
  • 4:13 - 4:19
    And you can use that knowledge of, like, how--like, fail after one, then fail
  • 4:19 - 4:22
    after two, then fail after three--to get information about every step
  • 4:22 - 4:25
    along the way. Specifically, that is what
  • 4:25 - 4:27
    traceroute is doing. So, let me clear the screen.
  • 4:27 - 4:33
    If we were to say traceroute google.com--
  • 4:33 - 4:37
    well, it gave us a whole bunch of stuff really quickly. Basically, what
  • 4:37 - 4:41
    it does is it sends out a series of ping
  • 4:41 - 4:45
    commands or ICMP packets, with specific
  • 4:45 - 4:50
    time-to-live--maybe, I don't think time-to-live is the proper
  • 4:50 - 4:55
    terminology, but maybe it is time-to-live--but only goes one hop.
  • 4:55 - 4:58
    And then, if it's not at its destination, it gets that information.
  • 4:58 - 5:01
    So basically, it pings every step along the
  • 5:01 - 5:02
    way and gives us information. Like, for
  • 5:02 - 5:09
    example, the first hop is my home pfSense router: 192.168.1.1.
  • 5:09 - 5:10
    Okay. So that's pretty cool.
  • 5:10 - 5:12
    Then the next hop is here. The next hop
  • 5:12 - 5:15
    is here. The next hop is here. And it will
  • 5:15 - 5:18
    continue to do that until you get to the
  • 5:18 - 5:22
    destination, which apparently was this IP address here for google.com.
  • 5:22 - 5:23
    Now, there are some times where you're not going to
  • 5:23 - 5:25
    get responses and you'll get things like
  • 5:25 - 5:27
    this, and that is where that particular
  • 5:27 - 5:33
    node or that hop along the way decided not to return ICMP traffic. It still
  • 5:33 - 5:37
    allows it to go through, but it doesn't reply. You can see it allows it to go
  • 5:37 - 5:39
    through because we got a response from
  • 5:39 - 5:43
    the next hop along the way. So if you see these, like, asterisk, asterisk,
  • 5:43 - 5:49
    asterisk--that just means that it didn't receive an ICMP reply at that hop.
  • 5:49 - 5:53
    Hopefully, that makes sense. But it has still forwarded those packets
  • 5:53 - 5:57
    on to the next destination because, again, we got the response from there.
  • 5:57 - 6:01
    So that is how traceroute finds the path.
  • 6:01 - 6:05
    It traces the path from one place to another and gives you information
  • 6:05 - 6:11
    along the way--how long it took to get to that particular hop from
  • 6:11 - 6:16
    where you are. So it's really useful information, but it's kind of old. Right?
  • 6:16 - 6:19
    It's an old-school way of doing things, and there is a new kid on the
  • 6:19 - 6:24
    block that gives us even more information in kind of a really nice way
  • 6:24 - 6:27
    as well. And if you remember the video we
  • 6:27 - 6:29
    did on top, and then I talked about htop
  • 6:29 - 6:34
    being a newer program that is probably the one you should use because
  • 6:34 - 6:36
    it's newer and better and faster and
  • 6:36 - 6:38
    more user-friendly and does more things--
  • 6:38 - 6:43
    this is the same sort of thing. MTR stands for My Traceroute, and it's
  • 6:43 - 6:47
    probably not installed by default on your distribution. So you'd have to, like,
  • 6:47 - 6:50
    install it with yum or with apt or
  • 6:50 - 6:51
    whatever your package management system
  • 6:51 - 6:54
    is. It's probably in your repositories, though.
  • 6:54 - 6:58
    And then you can use that in the place of--or in addition to--ping and
  • 6:58 - 7:01
    traceroute to get that same sort of information.
  • 7:01 - 7:05
    And the same binary works either GUI or on
  • 7:05 - 7:06
    the command line. So let me show you both
  • 7:06 - 7:12
    really quick. So we'll clear the screen, and now if we use mtr and we just--
  • 7:12 - 7:16
    without any flags--just give it a domain, google.com,
  • 7:16 - 7:19
    it will pop up a GUI window. If you're on
  • 7:19 - 7:21
    a desktop that has, you know, an X Windows--
  • 7:21 - 7:24
    or I'm sure Wayland as well--but with an
  • 7:24 - 7:25
    X server installed, it's going to pop up
  • 7:25 - 7:28
    a GUI window, and you'll see it keeps
  • 7:28 - 7:32
    updating in real time. Now, this is the traceroute information. Let me--yes--
  • 7:32 - 7:33
    scroll down here. Okay. These are the same
  • 7:33 - 7:39
    sort of things that we got when we used traceroute, but it allows us to see
  • 7:39 - 7:43
    things update. It just keeps sending packets, and then we get, like, the
  • 7:43 - 7:45
    standard deviation of how long it took.
  • 7:45 - 7:50
    These are in milliseconds. So, like, the last ping was 11
  • 7:50 - 7:54
    milliseconds here, 21 milliseconds, 7 milliseconds, 16 milliseconds.
  • 7:54 - 7:56
    And you can see along the way, like, if there's a
  • 7:56 - 7:57
    spot along the path where there's a
  • 7:57 - 7:59
    rough connection--oh, like, see there, we
  • 7:59 - 8:05
    just had some loss. There's some packet loss at that section along the
  • 8:05 - 8:10
    path from us to Google. And so this is a really great way to see if it's you or
  • 8:10 - 8:14
    if it's them. You know, like the site, is it down for everyone or just me? This is
  • 8:14 - 8:18
    a great way that you can test to see if there's a spot along the path that is
  • 8:18 - 8:22
    having issues. Like, apparently, this spectrum.com site is really having some
  • 8:22 - 8:24
    issues because we have packet loss at
  • 8:24 - 8:27
    that section of the journey, so to speak.
  • 8:27 - 8:29
    It doesn't necessarily mean that there's
  • 8:29 - 8:31
    a problem because they could just not be
  • 8:31 - 8:35
    replying because of load concerns. Like, if it's heavily loaded, it might just
  • 8:35 - 8:38
    drop packets instead of responding.
  • 8:38 - 8:41
    But if you have an issue and it's not working well, something like this
  • 8:41 - 8:45
    might show you a problem along the way. And this will work internally too.
  • 8:45 - 8:47
    Like, if you have a bunch of routers inside,
  • 8:47 - 8:52
    you can traceroute or MTR between them as long as it, you know, changes
  • 8:52 - 8:54
    subnets and that sort of thing. So, anyway,
  • 8:54 - 8:56
    this is MTR, but this is the GUI version,
  • 8:56 - 8:58
    and we can change things. We can pause it.
  • 8:58 - 9:03
    We can restart from scratch. Maybe unpause it. There we go. We can do all
  • 9:03 - 9:05
    sorts of things, change how quickly it
  • 9:05 - 9:12
    updates, but it also works on the command line if you do mtr -t.
  • 9:12 - 9:17
    We'll do it again. This is apparently what we're doing today--google.com.
  • 9:17 - 9:21
    And this will do the exact same thing, but in a text interface. So, like, if
  • 9:21 - 9:25
    you're SSH'd into a server, you're going to get this without the -t because
  • 9:25 - 9:29
    if it doesn't sense an X server, it's going to give you the text version.
  • 9:29 - 9:30
    But if you want to have it in your terminal
  • 9:30 - 9:35
    instead of a GUI pop-up, you can use -t to get the same information on a
  • 9:35 - 9:37
    terminal. And then, the keys up here, it
  • 9:37 - 9:42
    shows us there's, like, help and display and restart. We can do restart. I just
  • 9:42 - 9:46
    pressed r to restart, and it will do all that. Q should quit. Yeah.
  • 9:46 - 9:48
    And q quits. Okay. Now, do you remember when I talked about
  • 9:48 - 9:51
    some places stopping ICMP traffic?
  • 9:51 - 9:55
    Well, with MTR, you can do a really cool thing
  • 9:55 - 10:03
    where we can do mtr --udp google.com, and what this does--oh, I
  • 10:03 - 10:05
    didn't do -t, so it popped up another
  • 10:05 - 10:10
    window here. But what this is doing now is instead of using ICMP traffic, it is
  • 10:10 - 10:17
    sending out a UDP data packet, and we are getting information based
  • 10:17 - 10:22
    on UDP instead of ICMP. And we can do the same thing:
  • 10:22 - 10:26
    mtr --tcp google.com, and this is not using
  • 10:26 - 10:32
    ICMP traffic. Again, this is using TCP traffic. Yeah. Let's go over here.
  • 10:32 - 10:35
    I keep forgetting it's going to pop up a GUI window, but that's okay.
  • 10:35 - 10:37
    GUI windows are cool. And the same thing.
  • 10:37 - 10:39
    Rather than ICMP, right now it is using
  • 10:39 - 10:43
    TCP to check every hop along the way.
  • 10:43 - 10:45
    Alright. So, there's some really cool things
  • 10:45 - 10:49
    that you can do with it. But, basically, it is like a more advanced version of
  • 10:49 - 10:53
    traceroute. And now, one more non-controversial tool that I want to
  • 10:53 - 10:55
    show you--let's clear the screen--is
  • 10:55 - 10:59
    netstat. And I've shown you netstat before, and I even told you the flag
  • 10:59 - 11:02
    that I use 99.5% of the time. Do you
  • 11:02 - 11:09
    remember it? Netstat -tuna. Right? Netstat -tuna,
  • 11:09 - 11:13
    and this is going to show us the port information on our local computer.
  • 11:13 - 11:19
    So, netstat -tuna, just press that, and it'll show us all of the ports that
  • 11:19 - 11:22
    are open or in use on our local computer.
  • 11:22 - 11:24
    Okay? And that's important. I mean, this is
  • 11:24 - 11:28
    just testing our local computer, querying our local interfaces. Now, usually,
  • 11:28 - 11:32
    what I do--let me stretch this a little bit because that wrapped in an
  • 11:32 - 11:34
    awkward place. There we go. Yeah.
  • 11:34 - 11:36
    You can see the top ones. So this is going
  • 11:36 - 11:40
    to show us, like, if a daemon is listening, like, for example, on this computer,
  • 11:40 - 11:42
    apparently, there's an SSH server running
  • 11:42 - 11:49
    because it's listening on port 22 on 0.0.0.0, which means all interfaces, on
  • 11:49 - 11:53
    TCP version 4. It's listening on port 22, and it says it's listening right
  • 11:53 - 11:55
    there. So that's what we can do there.
  • 11:55 - 11:57
    But I thought for this video, specifically,
  • 11:57 - 12:03
    why don't we explain what each of those letters in tuna is for? So, let me
  • 12:03 - 12:09
    clear the screen. First of all, netstat
  • 12:09 - 12:13
    has to be spelled correctly. -t means
  • 12:13 - 12:20
    I want to know about TCP ports on the system. So the t is for TCP.
  • 12:20 - 12:25
    The u is for--can you guess? The u is for
  • 12:25 - 12:28
    UDP. -n. That means I want to know
  • 12:28 - 12:30
    about localhost. I want to know about
  • 12:30 - 12:35
    0.0.0.0. I want to know about, you know, if it's only listening on one of the IP
  • 12:35 - 12:40
    addresses, like 192.168.1.1. I want to know all of the network addresses
  • 12:40 - 12:46
    on the system. Tell me about all of them. And then, a is similar but slightly
  • 12:46 - 12:53
    different. a says, I want you to tell me about all interfaces. So n means all IP
  • 12:53 - 12:56
    addresses, like the localhost and every
  • 12:56 - 12:58
    IP address that might be assigned to the
  • 12:58 - 13:03
    system--including that special one, 0.0.0.0, which means all. a means every
  • 13:03 - 13:09
    interface. So eth0, eth1, eth2--which I know eth0 isn't really used anymore--
  • 13:09 - 13:12
    but, like, I always forget the, like, here, let's,
  • 13:15 - 13:18
    enp8s0. Basically, the a means I want you to tell
  • 13:18 - 13:24
    me about all of the interfaces on the system as well. And then, usually, like I
  • 13:24 - 13:28
    showed you before, usually I don't use that whole long thing. Usually, I will
  • 13:28 - 13:34
    grep the results. So, I'll do something like netstat -tuna, and then I will grep
  • 13:34 - 13:37
    for the word LISTEN, all in caps.
  • 13:37 - 13:43
    I guess, type the word grep. Grep for LISTEN, and it will show us just
  • 13:43 - 13:45
    the ports that are currently listening.
  • 13:45 - 13:47
    Meaning, like, a daemon that is listening
  • 13:47 - 13:51
    on the system. Like, if we had Apache installed, it would show, like, port 80
  • 13:51 - 13:53
    was here, and it would be in the LISTEN
  • 13:53 - 13:55
    state. So that's something I use netstat
  • 13:55 - 13:58
    for, and that covers everything except
  • 13:58 - 14:02
    the TCP dump, TShark, and Wireshark.
  • 14:02 - 14:04
    So let me quickly explain what they do.
  • 14:04 - 14:07
    And, basically, they cause people to get really opinionated.
  • 14:07 - 14:11
    What TCP dump and Wireshark are, both, are
  • 14:11 - 14:15
    packet capture tools. So they capture
  • 14:15 - 14:20
    packets from an interface, like a network interface on your computer.
  • 14:20 - 14:22
    Now, the important thing to note about any of
  • 14:22 - 14:27
    these tools, tcpdump or TShark (which is the text version of Wireshark),
  • 14:27 - 14:34
    Wireshark is a GUI program, is they can only capture packets that they see.
  • 14:34 - 14:38
    And what I mean by that is if you are on a network where
  • 14:38 - 14:43
    your computer is plugged into a switch, it's only going to be able to see
  • 14:43 - 14:46
    traffic that that switch port sees. So if
  • 14:46 - 14:49
    two computers on two separate ports are
  • 14:49 - 14:53
    talking to each other, your switch port is never going to see that traffic.
  • 14:53 - 14:56
    That's what switches do. Switches only
  • 14:56 - 14:58
    connect the traffic to where it needs to
  • 14:58 - 15:01
    go. A hub, on the other hand--a hub just
  • 15:01 - 15:05
    spews it everywhere, and whoever it's for can listen, but that's why they're
  • 15:05 - 15:09
    less efficient because a hub makes things very, very messy.
  • 15:09 - 15:12
    Everybody just screams all your information, and
  • 15:12 - 15:14
    then whoever needs it listens. But a
  • 15:14 - 15:15
    switch will connect two parties together,
  • 15:15 - 15:22
    and only those two are going to see each other. So that's why if you want to
  • 15:22 - 15:24
    capture packets for an entire network or
  • 15:24 - 15:27
    for something else, your switch might have, like, a mirror port, where, like,
  • 15:27 - 15:29
    your uplink port, you could mirror it on
  • 15:29 - 15:31
    another port, plug your computer into
  • 15:31 - 15:35
    there, and then listen, and it would hear all the traffic on this port
  • 15:35 - 15:37
    as well. So there are ways that you can get
  • 15:37 - 15:42
    stuff, but, also, you might have to SSH into a remote server and capture the
  • 15:42 - 15:44
    packets you want to see, bring them back
  • 15:44 - 15:47
    locally to examine them in Wireshark.
  • 15:47 - 15:51
    So when you capture packets, just realize the computer can only capture what it sees.
  • 15:51 - 15:52
    And with modern switching
  • 15:52 - 15:56
    technology, it doesn't see all the traffic in a network. That's just not how
  • 15:56 - 15:58
    networks work, except wireless networks.
  • 15:58 - 16:01
    Wireless networks are just hubs. For the
  • 16:01 - 16:02
    most part, you're going to have to use
  • 16:02 - 16:05
    sudo or root access to capture packets
  • 16:05 - 16:07
    just because you need access to the
  • 16:07 - 16:09
    interface, and usually only root has that.
  • 16:09 - 16:11
    There are ways to set it up using group
  • 16:11 - 16:12
    permissions and stuff, but, generally,
  • 16:12 - 16:16
    you're going to need root permissions to do a packet capture on an interface.
  • 16:16 - 16:17
    And so, the first two we're going to look at
  • 16:17 - 16:19
    are the older one, which is TCP dump.
  • 16:19 - 16:21
    It's been around forever. So I'm going to do
  • 16:21 - 16:24
    sudo tcpdump. Now, we can specify what
  • 16:24 - 16:26
    interface we want to listen on, but it'll
  • 16:26 - 16:28
    choose your default interface if you
  • 16:28 - 16:29
    don't specify it. So that's, you know, what
  • 16:29 - 16:33
    I'm going to do. Otherwise, we could do -I and tell it what specific
  • 16:33 - 16:38
    interface, but, again, I forget the names of the interfaces, like enpso75 blah,
  • 16:38 - 16:42
    blah, blah. Anyway, TCPdump will use your default network interface, and if
  • 16:42 - 16:47
    you just press enter, it will show all of the information that it sees on
  • 16:47 - 16:49
    the network. Again, just everything that
  • 16:49 - 16:53
    our local computer sees right here, but it's going to show a whole bunch of
  • 16:53 - 16:56
    traffic as it goes through the default
  • 16:56 - 16:58
    interface on my system. So I'm going to
  • 16:58 - 17:02
    hit Ctrl + C because that's just a lot of information, and it's not usually how
  • 17:02 - 17:08
    it's used. Usually, you'll capture something into a .pcap file, and that is
  • 17:08 - 17:11
    just a format that Wireshark can use to
  • 17:11 - 17:15
    look at it later on. And so, like I said, a lot of times, you'll SSH into a remote
  • 17:15 - 17:17
    server, do a packet capture, and then
  • 17:17 - 17:22
    bring that back. And that's why TCPdump is still often used. So we can say,
  • 17:22 - 17:24
    "I'm going to do that right now." I'll capture
  • 17:24 - 17:27
    some information using TCPdump.
  • 17:27 - 17:32
    So, let's say, sudo TCPdump, and I'm still going to use a default interface,
  • 17:32 - 17:36
    but we're going to say we're going to filter. So that's the
  • 17:36 - 17:41
    other thing that it can do. It can just get some traffic, rather than all of the
  • 17:41 - 17:48
    traffic everywhere. I'm going to get just traffic that's going to
  • 17:48 - 17:52
    my router, for example, like just traffic going to the router or from the
  • 17:52 - 18:00
    router. So I'll say TCPdump and then host 192.168.1.1, and then instead of just
  • 18:00 - 18:06
    spewing it on the screen, I want it to write the -w to, let's call it
  • 18:06 - 18:12
    dump.pcap. Alright? And that's going to save it into a .pcap file that we can
  • 18:12 - 18:14
    look at with Wireshark later. So when you
  • 18:14 - 18:16
    press enter, it's going to be listening.
  • 18:16 - 18:19
    It's dumping stuff in there. It's just going to keep going and keep going.
  • 18:19 - 18:21
    There are ways to set up, so it will only
  • 18:21 - 18:23
    capture for a certain amount of time.
  • 18:23 - 18:24
    It will only capture a certain number of
  • 18:24 - 18:27
    packets. You can explore the help page
  • 18:27 - 18:31
    for all those limitations. There are also lots of other filters you can use.
  • 18:31 - 18:36
    You can say, instead of just host, you can say host DST for just the
  • 18:36 - 18:42
    destination of 192.168.1.1, or just the source SRC of that, and it
  • 18:42 - 18:45
    will only capture packets whose source
  • 18:45 - 18:48
    is from there. And you can filter and run all
  • 18:48 - 18:51
    kinds of filters. You can even AND filters together. But when we're done,
  • 18:51 - 18:54
    I'm just going to do Ctrl + C. Okay.
  • 18:54 - 18:59
    And then ls -l * .pcap. And sure enough, there is our file.
  • 18:59 - 19:01
    It looks like we captured 47 kilobytes of
  • 19:01 - 19:03
    information. We'll look at that in just a
  • 19:03 - 19:07
    second, because looking at it, the best way to do that is with Wireshark.
  • 19:07 - 19:09
    It just really is. Okay? The other way we could
  • 19:09 - 19:12
    capture it, though, is with Wireshark
  • 19:12 - 19:17
    itself. The GUI tool can capture, but also TShark, which is the text version of
  • 19:17 - 19:20
    Wireshark, can capture without needing a
  • 19:20 - 19:25
    GUI interface. And they do very similar things as far as capturing packets.
  • 19:25 - 19:27
    Now T, and this is where people might get
  • 19:27 - 19:29
    controversial and be like, "No. No. No. It's so
  • 19:29 - 19:32
    much better. This is better. That's better. This is better. That's better."
  • 19:32 - 19:36
    They're both great. All three of them are great. There are slightly different
  • 19:36 - 19:38
    filters that you might be able to apply
  • 19:38 - 19:42
    with TShark, like, based on the internals of a packet. Like, if you're trying to
  • 19:42 - 19:47
    troubleshoot SIP information, you might be able to craft a filter in one that
  • 19:47 - 19:52
    works better than the other as far as like getting just SIP information from a
  • 19:52 - 19:53
    certain type of client or something.
  • 19:53 - 19:57
    Anyway, to do the same sort of thing with TShark, we do something like
  • 19:57 - 20:03
    sudo TShark, and then let's do a filter.
  • 20:03 - 20:08
    So in this case, to do a filter with TShark, it's -f and then the filter. And I am
  • 20:08 - 20:14
    going to do a filter of just ICMP traffic. Okay? And we'll just press enter.
  • 20:14 - 20:20
    And then what this should do is wait to look for ICMP traffic on the network.
  • 20:20 - 20:24
    It looks like it actually did find some. I'm not saving this to a file. I am just
  • 20:24 - 20:29
    letting this print on the screen. It looks like it is going to save a temp file for us in the temp folder,
  • 20:29 - 20:31
    but we're not going to look at that.
  • 20:31 - 20:33
    But we can write it to a file. But I
  • 20:33 - 20:38
    wanted to show you. Now, this is the same sort of thing we could do using
  • 20:38 - 20:45
    TCPdump, but we could do ping google.com. And now, when we ping, it's
  • 20:45 - 20:50
    going to capture or it's going to display all of those packets because it
  • 20:50 - 20:52
    matched the filter of ICMP traffic.
  • 20:52 - 20:54
    Does that make sense? So that's what actually
  • 20:54 - 21:01
    happened. It captured that. Again, I'm not capturing it to a file, but you
  • 21:01 - 21:03
    could do the same thing with TShark.
  • 21:03 - 21:06
    And then Wireshark is the GUI tool. So let's
  • 21:06 - 21:07
    open up Wireshark just to finish this
  • 21:07 - 21:10
    video off. And now remember, all of these
  • 21:10 - 21:15
    tools can do capture. So we could just start capturing packets. And in fact,
  • 21:15 - 21:18
    it'll just do that. It'll just start capturing packets, and we can look at them,
  • 21:18 - 21:23
    click stop, and then we can examine all of the packets that we have just
  • 21:23 - 21:26
    captured. And it just captured everything.
  • 21:26 - 21:27
    But it's cool because in
  • 21:27 - 21:30
    Wireshark, you can explore them at your
  • 21:30 - 21:34
    leisure without having to watch them scroll by. So look at this TCP
  • 21:34 - 21:38
    packet, for example. It will show all of the details of a packet. So if you're
  • 21:38 - 21:41
    having an issue, you can capture a packet
  • 21:41 - 21:43
    and you can capture some packets and
  • 21:43 - 21:47
    then search through to see, "Okay, here's where it's, you know, talking to this
  • 21:47 - 21:48
    server." So what's actually going on in
  • 21:48 - 21:50
    this conversation? And you can look at
  • 21:50 - 21:52
    the entire packet of information and see
  • 21:52 - 21:55
    what's going on, including the actual
  • 21:55 - 21:58
    data in the packet. So you can examine all sorts of stuff. Now if you're
  • 21:58 - 22:02
    thinking, "Whoa. If I can capture packets, that means I can see passwords."
  • 22:02 - 22:07
    Well, you can see login and passwords for protocols that are not encrypted.
  • 22:07 - 22:10
    So, like, traditional FTP or Telnet without
  • 22:10 - 22:14
    any encryption, yeah, you can see the actual text that's going through.
  • 22:14 - 22:17
    But for things like SSH, you can capture the
  • 22:17 - 22:19
    packets, but they're all encrypted. So all
  • 22:19 - 22:22
    you're going to see is the encrypted stuff. You're not actually going to see,
  • 22:22 - 22:24
    you're not going to find people's
  • 22:24 - 22:27
    passwords in there. Anyway, you can hear my dogs are excited again, but
  • 22:27 - 22:33
    what we could also do is open that file. Like, where's that file? Oh, you see I
  • 22:33 - 22:37
    have all sorts of stuff in there. I'm downloading some television shows.
  • 22:37 - 22:40
    But dump.pcap. This is the one that we had.
  • 22:40 - 22:43
    So I'm opening this. I'm going to continue without saving our captured
  • 22:43 - 22:46
    packets. But this is the information that
  • 22:46 - 22:49
    we captured using TCPdump. Remember, we
  • 22:49 - 22:51
    captured TCPdump, and our filter was
  • 22:51 - 22:56
    only stuff that was to or from the router 192.168.1.1.
  • 22:56 - 23:01
    And you'll see all of these packets that it captured are either has
  • 23:01 - 23:08
    a source or a destination of 192.168.1.1. 1.51 is the computer that we're on.
  • 23:08 - 23:09
    That's my big tuna machine. And it looks like
  • 23:09 - 23:13
    the bulk, if not all, of the we had one
  • 23:13 - 23:14
    that wasn't. Okay. Here was an ARP request.
  • 23:14 - 23:16
    This was ARP, but everything else
  • 23:16 - 23:22
    looks to be DNS. And so, almost everything else, oh, here's a broadcast,
  • 23:22 - 23:26
    an ARP broadcast. Looks like my Ubiquiti
  • 23:26 - 23:30
    something was looking for somebody who
  • 23:30 - 23:36
    knows who has the IP address of 1 or 192.168.1.1,
  • 23:36 - 23:39
    this Ubiquiti device is asking for that
  • 23:39 - 23:43
    because it knows that's the router that it needs to use to get out to the
  • 23:43 - 23:47
    Internet. But it does, the way that networking
  • 23:47 - 23:49
    works, it has to get the MAC address of
  • 23:49 - 23:51
    the computer with that IP address so it
  • 23:51 - 23:53
    knows how to talk to it. That's kind of
  • 23:53 - 23:55
    deep into the weeds with networking, but
  • 23:55 - 23:58
    that's really what we're looking at with Wireshark here is the nitty-gritty
  • 23:58 - 24:00
    packets that we can capture on our
  • 24:00 - 24:02
    system. So, yeah, like I said, this was not
  • 24:02 - 24:08
    an in-depth look at Wireshark, Tshark, TCPdump. Just know that it's for
  • 24:08 - 24:12
    capturing packets to examine individual packets for stuff. And usually, the
  • 24:12 - 24:16
    examination itself happens with the Wireshark utility, the GUI version.
  • 24:16 - 24:20
    TShark is, you can look at stuff using TShark.
  • 24:20 - 24:24
    It's not nearly as nice in my opinion. Usually, you just want to capture
  • 24:24 - 24:29
    a .pcap file and then bring that to a computer with a GUI interface and then
  • 24:29 - 24:33
    look at the captured packets with Wireshark so you can determine when
  • 24:33 - 24:37
    something is going wrong. But the important things to remember are it can
  • 24:37 - 24:40
    only capture the traffic that it sees.
  • 24:40 - 24:46
    So if you are trying to capture all the traffic from another computer, you
  • 24:46 - 24:48
    probably want to SSH to that computer to
  • 24:48 - 24:49
    do the capture, and then you can bring
  • 24:49 - 24:51
    that .pcap file back. Anyway, I hope that
  • 24:51 - 24:53
    was clear. Networking is so much fun.
  • 24:53 - 24:56
    And, again, there's so many courses, that we
  • 24:56 - 24:58
    could have started with just the topics
  • 24:58 - 25:00
    that we covered in this one. But this is
  • 25:00 - 25:03
    just how to use those tools and a little bit to make your life a little bit
  • 25:03 - 25:05
    easier and to pass that Linux Plus exam.
  • 25:05 - 25:07
    Anyway, learn everything. We have a
  • 25:07 - 25:10
    lot to learn in this video. Do what you
  • 25:10 - 25:13
    love. And most importantly, be kind. I will
  • 25:13 - 25:16
    see you in the next video and feel free
  • 25:16 - 25:19
    to join us on the Discord. There's a link down in the description.
  • 25:19 - 25:21
    There are a lot of people there who are super
  • 25:21 - 25:23
    smart, and we love to talk nerdy stuff.
  • 25:23 - 25:25
    So hope to see you there, and I will see you in
  • 25:25 - 25:30
    the next video. And it looks like I finished with about 12 minutes to spare,
  • 25:30 - 25:32
    so I might have a cup of coffee before
  • 25:32 - 25:36
    my next meeting. I mean, I guess I could edit. I'll start editing.
Title:
Network Monitoring Tools! (CompTIA Linux+ Objective 1.5.3)
Description:

more » « less
Video Language:
English
Duration:
25:37

English subtitles

Revisions Compare revisions