Linux Cheat Sheet for essential Network Commands
Whether troubleshooting connectivity issues, analyzing network traffic, verifying DNS resolution, or checking listening services, Linux provides a powerful set of built-in networking tools for day-to-day administration and debugging.
In this cheat sheet, we will look at some of the most essential Linux network commands commonly used for diagnostics, monitoring, and troubleshooting in enterprise and lab environments.
I will update this post on a regular basis.
Checking Listening Ports and Active Network Connections
The ss command is a modern and powerful replacement for legacy tools like netstat on Linux systems.
It can be used to quickly inspect listening TCP/UDP ports, active network connections, associated processes, and socket statistics, which is especially useful for troubleshooting network services such as SMTP, web servers, or SSH daemons.
For checking if Postfix is listening on TCP 25 e.g, the most useful ss command is:
# ss -tlnp | grep :25

Flags:
-t→ TCP sockets-l→ listening sockets only-n→ numeric ports/IPs-p→ show process using the socket
The following ss commands can be used to verify whether a DNS service is actively listening on UDP port 53 and to identify the associated process handling incoming DNS requests.
# ss -ulnp | grep :53

Flags:
-u→ UDP sockets-l→ listening sockets-n→ numeric output-p→ show associated process
Determine Public IP Address from Clients behind NAT by using DNS
The dig command can query Google’s public DNS service to determine the public IP address currently used for outbound internet connections.
This method is useful on Linux systems where external web services are unavailable or when troubleshooting NAT, firewalls, VPNs, and cloud networking configurations.
# dig TXT +short o-o.myaddr.l.google.com @ns1.google.com For Windows systems we can use: PS> (Invoke-RestMethod -Uri "https://api.ipify.org")
Display the global and per-link DNS settings in Ubuntu
The resolvectl status command displays the global and per-link DNS settings, routing domains, and protocol configurations (DNSSEC, LLMNR, MulticastDNS) currently handled by the systemd-resolved service. It is the updated utility (introduced in systemd 239) for the older systemd-resolve --status command.
$ resolvectl status or for a specific interface: $ resolvectl status ens192

Historically, /etc/resolv.conf was the definitive file where Linux looked to find its DNS servers. However, in modern Ubuntu systems, systemd-resolved handles DNS.
When you run cat /etc/resolv.conf as shown below, you are looking at a stub file generated by systemd-resolved to keep legacy applications happy.
nameserver 127.0.0.53: This is a local loopback address. Your applications aren’t talking directly to the internet for DNS; they are talking to a local “stub resolver” daemon running right on your machine (systemd-resolved).
# cat /etc/resolv.conf

SLES (SUSE Linux Enterprise Server) still uses /etc/resolv.conf, but it handles DNS management completely differently than Ubuntu.
While Ubuntu relies on systemd-resolved (using the 127.0.0.53 loopback), SLES uses a proprietary SUSE tool called netconfig to manage this file.
Unlike Ubuntu, which hides the real DNS behind
127.0.0.53, SLES writes your actual, real upstream DNS server IP (10.0.0.70) directly into/etc/resolv.conf. There is no local caching stub resolver running by default. Applications query10.0.0.70directly.
# cat /etc/resolv.conf

In the SUSE ecosystem, netconfig is a modular tool that gathers network settings from various sources (like DHCP leases, Wi-Fi connections, or static configuration files) and merges them into a single, cohesive network state.
It then automatically outputs the final result to /run/netconfig/resolv.conf, which /etc/resolv.conf points to via a symlink.
As the header text warns you, do not manually edit /etc/resolv.conf because netconfig will overwrite it the next time your network restarts or DHCP renews.
If you want to add static DNS servers in SLES use the Yast utility or open the network configuration file. Find and modify these exact variables (as mentioned in your file’s header):
NETCONFIG_DNS_STATIC_SERVERS="10.0.0.70" NETCONFIG_DNS_STATIC_SEARCHLIST="matrixpost-lab-net"
# vi /etc/sysconfig/network/config

Force netconfig to apply your changes immediately by running:
# netconfig update -f
Links
ss — Linux manual page
https://man7.org/linux/man-pages/man8/ss.8.html
