Wireshark - Install and Configure on Ubuntu and CentOS

In this chapter, you will learn

  1. What is Wireshark?
  2. How to Install it on Ubuntu and CentOS?
  3. How to capture network packets using Wireshark?

Wireshark is a very popular network packet analyzer and a great alternative to TCPDump . It is an open-source, graphical user interface, and widely used network analysis tool that monitors every packet traveling through your network.

Wireshark is a GUI-based network analyzer tool. If you want to use Wireshark as a command-line utility, install TShark .

While you are reading this article, several packets are being sent or received on your computer in the background. To see what is happening inside your computer network, let's install and configure the Wireshark network utility.

Installation of Wireshark

Wireshark comes pre-installed with most Linux distributions, so verify the existence of Wireshark before attempting to install it.

wireshark -version
Wireshark 3.6.2 (Git v3.6.2 packaged as 3.6.2-2)

Install on Ubuntu:

Step 1: Add the stable official PPA to repositories.
sudo add-apt-repository ppa:wireshark-dev/stable
Step 2: Update and Upgrade the repository.
sudo apt update && sudo apt upgrade -y
Step 3: Install Wireshark
sudo apt-get install wireshark
Step 4: Run Wireshark
sudo wireshark

Install on CentOS

yum install wireshark-gnome

How to use Wireshark?

Wireshark is GUI based packet analyser tool so its interface makes it easier to use it.

Step 1: Launch Wireshark by executing the following commands.
sudo wireshark
Step 2: You will see the list of all the available network interface. Just double-click on first interface or double-click on "any" to analyze all the network interfaces.
Wireshark configuration
Step 3: The Wireshark will start capturing the network packets. To stop the Wireshark just click on the red square button on the menubar.
Wireshark configuration
Step 4: To Save the output, click on the File → Save.
Step 5: There are more various options are available on Wireshark, just explore all the options to analyze network packets efficiently.