The Wayback Machine - https://web.archive.org/web/20240821134413/https://www.geeksforgeeks.org/command-line-tools-and-utilities-for-network-management-in-linux/
Open In App

Command-Line Tools and Utilities For Network Management in Linux

Last Updated : 21 Apr, 2022
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

If you are thinking of becoming a system administrator, or you are already a system admin, then this article is for you.

As a system admin, your daily routine will include configuring, maintaining, troubleshooting, monitoring, securing networks, and managing servers within data centers. Network configuration and troubleshooting are some important tasks that system admin know to perform.

Sometimes networked systems fail and you as a system admin have to diagnose and resolve the problems. So when it comes to Linux,  you as a system admin would get access to numerous tools and utilities in Linux, designed for administrative purposes that we are going to discuss 13 of them today in this article.

Network Configuration, Troubleshooting and Debugging Tools

1. ifconfig Command:

Ifconfig is a system administration utility for network interface configuration in Linux that is used to initialize interfaces at system boot time. Features like configuring, controlling, and querying TCP/IP network interface parameters are available in ifconfig. Setting up the IP address and netmask of any network interface and disabling or enabling any interface are some usages of ifconfig .

The status of IP Address, Hardware / MAC address and MTU (Maximum Transmission Unit) size of the currently active interfaces can be viewed

The status of all active network interfaces can be seen using the following command:-

 $ ifconfig

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

For listing all interfaces currently available, whether up or down, use the -a flag. like this:

$ ifconfig -a  

For assigning an IP address to an interface, run the following command:

$ sudo ifconfig eth0 195.167.54.6 netmask 255.255.255.0

For activating a network interface, use the following command:

$ sudo ifconfig up eth0

For deactivating or shutting down a network interface, run the following command:

$ sudo ifconfig down eth0

2.  Ethtool Command:

Ethtool is another command-line utility for displaying and modifying network interface controllers (NICs) parameters & device driver software. This tool is also useful for identifying & diagnosing  Ethernet devices, upgrading firmware in flash memory, etc.

For displaying the current parameters for the network interface, use the following command:-

ethtool [network interface]

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

3. IP Command :

IP command is kind of a replacement of ifconfig command. This command is used to perform different network administration tasks. This command is used to display or manipulate routing, devices, network devices, and tunnels. Although it is similar to ifconfig command but way too powerful including more functions and facilities in it. 

To display the IP address and other information about a network interface using the following command:-

$ ip addr show

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

For temporarily assigning IP Address to a specific network interface (eth0), use the following command:-

$ sudo ip addr add 195.162.54.2 dev eth0

For removing an assigned IP address from a network interface (eth0), use the following command:-

$ sudo ip addr del 195.162.54.15/24 dev eth0

Display the current neighbor table in the kernel, use the following command:-

$ ip neigh

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

4.  ifup, ifdown, and ifquery command:

Ifup command, in general, brings the network interface up, which allows the user to transmit and receive data by using the following command:

$ sudo ifup eth0

Ifup command, in general, brings the network interface down, which doesn’t allow the user to transmit and receive data by using the following command:

$ sudo ifdown eth0

To display information about a network interface’s configuration we use ifquery command by using the following command:

sudo ifquery eth0

5. Ping Command:

Ping(Packet INternet Groper)  command is a computer network administration software utility to test the reachability between two systems on Local Area Network (LAN) or Wide Area Network (WAN).

For communicating to nodes on a network ping sends Internet Control Message Protocol (ICMP) echo request packets to the targeted host and waits for an ICMP echo reply showing the ping is successful.

For testing connectivity to another node, we have to provide the Ip address /hostname, Syntax look like this:

IPv4: ping <ip address> / <host name>
IPv6: ping6 <ip address> / <host name>

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

By using the -c flag you can also tell ping to exit after a specified number of ECHO_REQUEST packets as follows:

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

6. Netstat Command:

netstat is a command-line utility used for getting useful information regarding network connections, routing tables, interface statistics. It is also very useful for finding problems in the network and troubleshooting them and also determines the amount of traffic on the network.

As netstat is a network service debugging tool, it is used to check which programs are listening on what ports. To check which program is listening on what port by displaying all TCP ports in listening mode, use the following command:

$ sudo netstat -tnlp

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

For viewing the kernel routing table, we have to use the -r flag ( equivalent to the running route command that we discussed).

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

For displaying all ports; (for specifying only TCP use -at, for UDP use -au) use the following command:

$ netstat -a 

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

For displaying transmission/receive (TX/RX) packet statistics for each interface using the -i flag

7. NC Command:

NC (NetCat) is a great security tool or network monitoring tool utility which is often referred to as a Swiss army knife of networking tools. 

It is used for reading from and writing to network connections using TCP or UDP. It has some remarkable features that include port scanning, transferring files, and port listening, and it can be used as a backdoor by hackers.

Netcat (nc) implied with Pv command together can be used to transfer files between two computers.

For performing Port Scanning. Run the following command:-

$netcat -z -v 127.0.0.1 1234 (Scanning a single port)
$nc -z -v 127.0.0.1 1234 1235 (Scanning multiple ports)
$nc -z -v 127.0.0.1 1233-1240 (Scanning a range of ports)

To send an HHTP on any website, suppose here I am sending it on GeeksforGeeks, then use the following command:-

printf “GET /nc.1 HTTPs/1.1\r\nHost: www.geeksforgeeks.org\r\n\r\n” | nc www.geeksforgeeks.org 80 

8. Nmap Command:

Nmap (Network Mapper) is a  powerful free and open-source network scanner for Linux system/network administrators. To discover hosts and services on a computer network, Nmap is used by sending packets. Nmap features include Port scanning, detects MAC addresses, Version detection, OS detection, Network inventory, network mapping, etc.

We can scan a host using its hostname or IP address, by using the following command:-

nmap google.com
nmap <ip address>

9.  NSLookup Command:

Nslookup ( “Name Server Lookup”) is a network administration command-line tool to query DNS servers both interactively and non-interactively to obtain domain name or IP address mapping, and DNS resource records (RR).

IP Address of the domain will be displayed after writing the following command:-

$ nslookup [domain name]

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

 We can also perform a reverse domain-lookup by using the following command:-

$ nslookup [ip address]

 

16. dig Command:

dig (domain information groper) command-line tool for querying the Domain Name System. NS-related information such as A Record, CNAME, MX Record, etc is retrieved using this command. NsLookup and host command are replaced by dig command.

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

10. Tcpdump Command

Tcpdump is a powerful data-network packet analyzer It is used for capturing network traffic in packets that are transmitted or received. System Administrators use this command to troubleshoot connectivity issues in Linux. Tcpdump listens to the network traffic and prints packet information that is based on the different criteria given by us about specific ports, protocols, etc. Captured information is saved in a pcap file, that can be then opened through Wireshark or through the tcpdump command itself.

Syntax:
tcpdump -i <interface-name>  [ live packets from the specified interface will be displayed.]
tcpdump -i <interface> src <source-ip>[  packets are captured from a particular source IP.]
tcpdump -i <interface> dst <destination-ip>  [packets are captured from a particular destination IP.]
tcpdump -c 5 -i <interface name> [ capture a specific number of packets]
tcpdump -w captured.pacs -i  <interface name>  [ capture and save packets to a file ]

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and DebuggingA Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

11. Wireshark Utility:

Wireshark is a great utility to capture and analyzing packets in GUI mode in real-time. Wireshark is considered very important as a networking-related professional. The captured data can be saved for later inspection. 

12. Iptables Firewall:

iptables is a firewall-like packet-filtering utility used by the system administrator for configuring, maintaining, and inspecting the IP packet filter rules of the Linux kernel firewall.  Linux firewall (Netfilter) is set up and managed by iptables. Iptables allow you to add or delete or modify packet filter rules in the existing packet filter rules.

Syntax:
iptables -L (lists of all the existing iptables rules.)
iptables -A INPUT -i <interface> -p tcp –dport <port-number> -m state –state NEW,ESTABLISHED -j ACCEPT  ( it will allow  traffic from the specified port number to the specified interface)
iptables -A INPUT -i lo -j ACCEPT (allow loopback access to the system)

 

note: Firewalld and iptables can’t be used at the same time on same server — you must choose one.

13. UFW (Uncomplicated Firewall):

Uncomplicated Firewall (UFW) that manages a Netfilter firewall and is a well-known program and default firewall configuration tool on Debian and Ubuntu Linux distributions. It uses iptables for configuration.

 Check UFW firewall status, type the following command:

$ sudo ufw status

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

Active and disable the UFW firewall using the following command:

$ sudo ufw enable
$ sudo ufw disable 

You can get the Gui version, by typing the following command:

$ gufw

A Linux Sysadmin’s Guide to Network Management, Troubleshooting and Debugging

For finding more information about a particular program see the manual page:

$ man programs_name


Previous Article
Next Article

Similar Reads

Netnoob - Network tools, information gathering tools and scanning tools
Netnoob is an automated tool that is developed for Network Recon, Scanning, and Network Auditing. Netnoob tool has the features to Get information about your computer and network, Get information about another computer or a network, Network Settings, and Shared Drives. This tool allows us to change the IP address and MAC Address of our system and a
2 min read
How to Manage KVM Virtual Environment using Command Line Tools in Linux
KVM, short for Kernel-based Virtual Machine, is a complete virtualization solution for Linux running on x86 hardware (Intel VT or AMD-V). Since version 2.6.20, the mainline Linux kernel has featured KVM, a complete virtualization solution for Linux running on Intel 64 and AMD 64 hardware that is fast and stable for the majority of workloads. It con
8 min read
How to Compare Files Line by Line in Linux | diff Command
In the world of Linux, managing and comparing files is a common task for system administrators and developers alike. The ability to compare files line by line is crucial for identifying differences, debugging code, and ensuring the integrity of data. One powerful tool that facilitates this process is the diff command. In this article, we will explo
9 min read
Manage Network Connections From the Linux Command Line with nmcli
Network connectivity is a critical aspect of modern computing, and Linux provides a robust command-line tool for managing network connections: nmcli. Network Manager Command-Line Interface (nmcli) is a powerful and versatile utility that allows users to control and configure network settings directly from the terminal. In this article, we will delv
5 min read
Ccat – Colorize Cat Command Output command in Linux with Examples
ccat is a command-line tool for Linux and OSX, which is similar to the cat command in Linux. But the difference between cat and ccat is that the ccat shows the content of the file with the syntax highlighted. Currently, ccat supports the following programming languages. JavaScriptJavaRubyPythonGoCJSONInstallation of Ccat First, we are going to see
2 min read
How to Display Command History in Linux | history Command
The command-line interface in Linux provides powerful tools for users, and mastering command history is essential for efficient navigation and retrieval of previously executed commands. The history command is a valuable utility that allows users to view and search through their command history. In this comprehensive guide, we will explore the vario
4 min read
How to Install and Use Sysdig from Linux Command Line?
Sysdig is a tool that provides administrators and developers with unparalleled insight into their systems' behavior. The team behind it hopes to enhance system-level monitoring and troubleshooting by providing a centralized, coherent, and granular view of the storage, transmission, network, and memory subsystems, as well as the ability to generate
2 min read
Optimize and Compress JPEG or PNG Images in Linux Command line
Today there are many GUI tools that compress and optimize the images, which are very useful. But if you are terminal addicted and want to compress and optimize the images in the terminal before uploading to the cloud, then you can do it. There are two tools by using which we can compress and optimize images. These are - jpegoptimOptiPNGjpegoptim jp
4 min read
Top Linux Command Line Tips and Tricks
Linux is a great OS that offers multiple options for simplifying tasks. It has everything you need for working more efficiently, whether a command-line or a GUI. However, many people don't know the Linux command line's short tricks and end up being stuck in complex tasks. An interface (text-based) through which you communicate with your system's OS
5 min read
Iperf Command to Test Speed, Performance and Bandwidth of Network in Linux
There is a great degree of flex in how the packets are delivered and overall bit rate and packet payload size can be controlled. iperf is a tool that is used to perform network performance measurement and tuning. iperf is an open-source software which is written in C language. Jperf is a GUI version for doing the same job. The core concept work beh
2 min read
How to Download YouTube Videos in Linux Command Line?
The videos can be downloaded from the online source through the Linux terminal using the youtube-dl tool. youtube-dl is a Python-based small command-line tool that makes it possible to download the videos from Youtube, Facebook, Dailymotion, and few more similar sites. It is written in PyGTK and requires Python interpreter to run this program, it’s
2 min read
Connecting to the Internet Using Command Line in Linux
Many of the times you may use a Linux system that does not have a GUI after install and it needs an internet connection to set up a desktop environment, also you may use Linux servers without a GUI and you need to connect over a wireless network using the command line. Below you will see Steps to connect to a wireless network using the command line
3 min read
Kali Linux - Command Line Essentials
Command-line plays a vital role while working with Kali Linux as most of its tools don't have a Graphical User Interface and if you are performing ethical hacking or penetration testing then most of the time you will have to work with command Line Interface itself. While executing a command in Kali Linux we enter a command on the terminal emulator
3 min read
Deepl - Command Line Language Translator Tool for Linux
Deepl is the best language translator command-line tool that detects the language of input text and translates it into the desired language using advanced machine learning and neural networking algorithms. It is open source and powered by a German tech Company under the MIT license. It supports the following languages English (EN)Italian (IT)Spanis
3 min read
How to Convert PDF to Image in Linux Command Line?
Pdftoppm is a tool that converts PDF document files into .PNG format and many other formats. We can use this tool on Linux to convert the PDF into images. It also provides the features like the cropping image, set resolution, and scale, and many more. Now let's see how to install the pdftoppm Installation of pdftoppm: To install the pdftoppm, we ne
3 min read
Aria2 - Multi-Protocol Command-Line Download Tool for Linux
Aria2 is an open-source lightweight multi-protocol, multi-server &amp; multi-source command-line utility that is used for downloading files in Windows, Linux, and Mac. Aria2 is used to download a file at a good speed by utilizing your maximum download bandwidth from multiple sources/protocols such as HTTP(S), FTP, SFTP, Bittorrent, and Metalink. Yo
4 min read
How to Create a Text File Using the Command Line in Linux
There are a couple of quick ways to create a text file from the Linux Command Line or Terminal. Some of them have been explained in the following article. 1) touch commandThis is the most standard command to quickly create an empty text file. The command is quite simple to type and makes it quite easier to create several text files at once. The com
6 min read
How to Pass Command Line Arguments to GDB in a Linux Environment?
The GNU Debugger, commonly known as GDB, is a powerful tool used for debugging and analyzing programs in Linux and other Unix-like operating systems. While GDB is commonly used to debug programs, it can also be used to launch programs with specific command line arguments. This article will walk you through the process of passing command line argume
6 min read
Open Google Chrome From The Linux Command Line
Google Chrome is known as the most used and widely popular web browser because of its fast and better performance. In this article we will learn how we can open the Google Chrome application by using the terminal in Linux along with this we will also look at some you should command line switches to help you to start using the Google Chrome browser
6 min read
MySQL in Kali Linux Command Line
Below is a comprehensive MySQL Command Line tutorial for Kali Linux, starting from beginner to advanced levels. MySQL is a popular open-source relational database management system, and Kali Linux is a Debian-based Linux distribution often used for penetration testing and ethical hacking. Make sure you have MySQL installed on your Kali Linux system
10 min read
Uninstall Node.JS Using Linux Command Line
To uninstall Node.js from your Linux system using the command line, you can follow these steps. The specific commands may vary depending on your Linux distribution, so I'll provide instructions for a few common package managers: APT (Debian/Ubuntu), YUM (Red Hat/CentOS), and DNF (Fedora). Check if Node is Already Installed or NotEnter the following
3 min read
How to Check Network Connectivity in Linux | ping Command
Ensuring a stable and reliable internet connection is crucial for seamless navigation and efficient communication in the world of Linux. The "ping" command is a powerful tool that allows users to check the status of their internet connection and diagnose network-related issues. In this article, we will explore how to use the ping command in Linux t
7 min read
Linux Sysstat Utilities For Monitoring System Performance
Sysstat is a useful utility that includes a number of programs for monitoring system resources, performance, and use. The sysstat package contains a number of programs that we all use on a daily basis. It also includes a program that can be used to collect all performance and activity data. Installing Sysstat The Sysstat package is available in the
1 min read
Linux - Network Monitoring Tools
Network monitoring is using a system (hardware or software) that continuously observes your network and the data flows through it, depending on how the monitoring solution actually functions and informs the network administrator. We can keep a check on all the activities of our network easily. While Network management we need network Monitoring. Ne
4 min read
How To Use IPRoute2 Tools to Manage Network Configuration on a Linux
In computer networking, the iproute2 command line utility tool is a versatile and powerful tool for users. it provides beginner-friendly functionality to manage and configure the network. In this article, we are going to discuss each and every part of the iproute2 tool and how to implement it in our system. By the end of this article, you'll have s
4 min read
How to Convert DOS line endings to Linux line endings using Vim
DOS and Unix/Linux file formats differ slightly such that the ASCII characters used at the line endings are different. Unix file format uses an LF character to end a line, LF stands for LineFeed, which means moving the cursor down. Unix-based systems and Mac OS X &amp; later use this format. While the DOS file format uses a CR character before the
2 min read
Linux Process Management Command Cheat Sheet
On Linux computers there are special commands to control the programs that are running. These commands are called process management commands. With the help of process management commands you can look at the list of the programs that are currently running on your computer. You can also start new programs and run them and stop programs that are alre
6 min read
Bash shell script to find out the largest value from given command line arguments
Write a shell script to find out the largest value from the given number of command-line arguments. Example: Special variables in bash: $@- All arguments. $#- Number of arguments. $0- Filename. $1, $2, $3, $4 ... - Specific arguments. Approach If the number of arguments is 0, end the program. If not zero, then Initialize a variable maxEle with firs
1 min read
GithubFind3r - Fast Command Line Repo/User/Commit Search Tool
GithubFind3r is an automated tool developed in Node JS which is a CLI-based tool used to get information about the Repositories, Commits, and information about the Users from GitHub. GithubFind3r is available on GitHub, it's free and open-source to use. The GithubFind3r tool displays the results in a more sophisticated and more attractive manner. N
2 min read
Bash Script - How to use Command Line Arguments
In this article, let us see about Command Line Arguments usage in Bash script. Arguments are inputs that are necessary to process the flow. Instead of getting input from a shell program or assigning it to the program, the arguments are passed in the execution part. Positional Parameters Command-line arguments are passed in the positional way i.e. i
4 min read
Article Tags :
three90RightbarBannerImg