An Essential Sys Admin and Security Tool
Wireshark
Wireshark fills the gap between security and system administration for those who need to know more about what’s flowing through the wires or over the airwaves in the corporate network.
Special Thanks: This article was made possible by support from Linux Professional Institute
Wireshark is an essential system administrator and security tool for any network. That broad statement covers a lot of ground, but it is true nonetheless. Even on the Wireshark website, the About page refers to it as “the world’s foremost and widely-used network protocol analyzer.” It began life in 1998 with the name Ethereal, but the authors had to change it a few years later due to a trademark problem for the original author, Gerald Combs. Wireshark is cross-platform, free, and open source.
Before getting too far into this discussion, you must obtain permission to run Wireshark on your network. On many enterprise networks, it is forbidden to run protocol analyzers and to sniff network traffic unless you are part of a security group or have special permission to do so.
Understanding Wireshark
Wireshark is a network protocol analyzer -- sometimes referred to as a packet analyzer or as a network sniffer (see the “Caution” box). It offers live network packet capture and offline analysis. If you’ve ever used Wireshark, or any network sniffer, you know that it only takes a few minutes to capture thousands of packets. For this reason, Wireshark has a very powerful display filter, which you’ll learn to love, because who really needs to see thousands of “Who has” Address Resolution Protocol (ARP) messages, unless that’s what you’re looking for in a capture?
So what does one find when “sniffing” the network? In other words, what can you do with Wireshark? I’ve seen many lists that attempt to show Wireshark’s many facets, and here’s another one:
- Find network communications sent in clear text.
- Find evidence of attacks or probes.
- Discover clandestine or forbidden applications.
- Read captures from other programs, such as tcpdump.
- Take snapshots of traffic during peak periods.
- Establish a baseline of “normal” network traffic.
- Capture traffic to or from specific hosts.
- Look at attempts to connect to your wireless networks.
There are many other tasks one can perform with Wireshark, but these are the ones most often listed by legitimate users (see the “Hackers Beware” box).
Another word of caution to you would-be hacker types: Before you sniff around on public WiFi access points, such as those in local coffee shops or Internet cafes, don’t do it. It’s a crime.
A final word on what Wireshark is not. It is not a security information and event management (SIEM) suite nor should it be “sold” to management as such. It is no substitute for a SIEM, although its data can be used for some of the same activities, such as event correlation and forensic packet analysis.
Wireshark is a powerful tool that should be part of a system or security administrator’s arsenal of tools. However, be cautious of relying too heavily on any single tool for complete analysis. Such reliance reminds me of the Indian parable of the blind men and the elephant, where each man experiences a different part of the elephant and makes assumptions about the entire animal based on limited information. Gather as much information about an incident and network behavior as possible with different tools and from different perspectives.
Installing Wireshark
The first thing you need to do is install Wireshark. For Red Hat Linux-based systems, installing is easy with:
sudo yum –y install wireshark-gnome
Yes, I suggest that you install the graphical version. You can install the command-line-only version with:
sudo yum –y install Wireshark
You actually get the command-line version when you install the wireshark-gnome package. You also download and install any dependencies, which is usually just the libsmi package but could vary depending on your personal installation.
For Debian-based systems, use:
sudo apt install wireshark
This command installs both the command-line version and the graphical version.
If your system can’t find Wireshark, use these commands and try again:
sudo add-apt-repository ppa:wireshark-dev/stablesudo apt-get update
Up and Running
Now that you have Wireshark installed, it’s time to launch it and grab some network traffic. Although Wireshark’s installation program provides you with a handy program link under Applications | Internet, don’t use it unless you’re logged in as root. Open a Terminal window and enter:
sudo wireshark &
Wireshark should launch and look similar to Figure 1.
I know you want to get right to it, so click Capture on the menubar and select Interfaces from the dropdown list as shown in Figure 2.
The first step in capturing packets is to set up listening interfaces.
Note: You must either run Wireshark as root or use sudo to run it. There are ways around this, but for simplicity, run it with elevated privileges. You can run Wireshark as a regular user, but you won’t be able to capture traffic.
Figure 3 displays a list of local interfaces. Select those appropriate for your network.
Click Start to begin capturing network packets on your selected network interface. Figure 4 shows a capture in progress.
Figure 5 shows a system being scanned by a port scanner (we will look at this again later).
And finally, Figure 6 is a demonstration of a ping flood.
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.