50 Linux Networking Commands Every DevOps Engineer Should Master

Trix Cyrus - Oct 7 - - Dev Community

Author: Trix Cyrus

Waymap Pentesting tool: Click Here
TrixSec Github: Click Here

1. Basic Networking Commands

These are the fundamental commands every DevOps engineer should know to check basic networking information.

ifconfig – Shows network interfaces and their IP addresses.
ip a – Displays IP address information.
ping – Sends ICMP echo requests to test network connectivity.
traceroute – Traces the route packets take to reach a destination.
nslookup – Queries DNS to get information about domain names.
dig – Performs DNS lookups with more detailed output.
netstat – Shows network connections, routing tables, and statistics.
ss – Displays socket statistics, replacing netstat.
hostname – Displays or sets the system’s hostname.
ip link – Displays or configures network interfaces.
Enter fullscreen mode Exit fullscreen mode

2. Network Interface and IP Address Management

These commands help you manage and troubleshoot network interfaces and IP addresses.

ip addr show – Displays all IP addresses assigned to interfaces.
ifdown – Takes a network interface down.
ifup – Brings a network interface up.
ip link set dev up/down – Enables or disables a network interface.
ip route – Displays or modifies the IP routing table.
route – Displays or manipulates the routing table.
ip link show – Shows the status of network interfaces.
nmcli – Manages network interfaces using NetworkManager.
ethtool – Displays or modifies Ethernet device settings.
iwconfig – Configures wireless network interfaces.
Enter fullscreen mode Exit fullscreen mode

3. Network Packet and Traffic Analysis

These commands are used to capture and analyze network traffic for troubleshooting.

tcpdump – Captures network packets in real-time.
wireshark – A graphical tool for analyzing network packets.
tshark – Command-line version of Wireshark.
ngrep – Searches network traffic for patterns.
nmap – Network exploration tool and security scanner.
iperf – Measures network bandwidth between two hosts.
bmon – Monitors bandwidth usage on network interfaces.
iftop – Real-time bandwidth monitoring.
vnstat – Monitors network traffic and bandwidth usage.
mtr – Combines traceroute and ping for network diagnostics.
Enter fullscreen mode Exit fullscreen mode

4. Network Configuration and Troubleshooting

These commands help configure networks, diagnose connectivity issues, and modify firewall rules.

iptables – Configures network packet filtering rules (firewall).
ufw – Simplified firewall management tool.
firewalld – Manages firewall dynamically using zones.
ip rule – Manages routing policy database.
ip maddr – Shows or manages multicast addresses.
ip neighbor – Displays neighbor (ARP) tables.
arp – Displays and modifies the system's ARP table.
bridge – Manages network bridge devices.
conntrack – Monitors and manages connection tracking tables.
ip xfrm – Manages IPsec policies.
Enter fullscreen mode Exit fullscreen mode

5. DNS and Hostname Management

Manage DNS and hostname resolution for your servers and troubleshoot domain-related issues.

host – Queries DNS servers for specific records.
resolvectl – Queries the systemd resolver.
systemctl restart network – Restarts networking services.
systemctl restart NetworkManager – Restarts NetworkManager.
chattr +i /etc/resolv.conf – Prevents changes to DNS configuration.
dnsmasq – Lightweight DNS, DHCP, and router advertisement server.
named-checkconf – Checks DNS configuration files for errors.
named-checkzone – Verifies zone files for DNS.
curl – Fetches web pages and data via HTTP, FTP, and more.
wget – Downloads files over HTTP, HTTPS, and FTP.
Enter fullscreen mode Exit fullscreen mode

~Trixsec

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .