DevOpsLesson
DevOpsLesson

Free, comprehensive DevOps tutorials and learning roadmaps. Master Docker, Kubernetes, CI/CD, and more.

Stay Updated

Get notified about new tutorials and features.

Tutorials

  • What is DevOps?
  • Docker Tutorial
  • Terraform Tutorial
  • CI/CD Pipeline
  • All Tutorials

Roadmaps

  • DevOps Engineer
  • Cloud Engineer
  • SRE Path
  • All Roadmaps

Company

  • About Us
  • Blog
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 DevOpsLesson. All rights reserved.

DOCKERKUBERNETESTERRAFORMAWSCI/CDLINUXGITDEVOPS ROADMAPCLOUD ROADMAPSRE ROADMAPGIT CHEATSHEETDOCKER CHEATSHEETK8S CHEATSHEETTF CHEATSHEETLINUX CHEATSHEETDOCKERFILE LINTERYAML VALIDATORCRON PARSERREGEX TESTER

Linux Tutorial

Introduction to Linux
Linux Filesystem
Linux Navigation
Linux File Operations
Linux Text Processing
Linux Permissions
Linux Users and Groups
Linux Process Management
Linux systemd Basics
Linux Networking
Linux Disk and Storage
Linux Bash Scripting
Linux Package Management
Linux Environment Variables
Linux Cron Jobs
Linux SSH Keys
Linux Firewall Basics
Linux Log Management
Linux Performance Monitoring and Troubleshooting

Linux Networking

PreviousPrev
Next

Learn essential Linux networking commands for inspecting addresses, testing connectivity, transferring files, and understanding DNS resolution.

Why Networking Skills Matter

In DevOps, many “application problems” are really networking problems. A service may be healthy but unreachable, a DNS name may resolve incorrectly, or a firewall may block the expected port.

Linux includes strong networking tools for checking addresses, routes, listening ports, remote connectivity, and file transfers.

Inspecting Interfaces with ip addr

The modern command for viewing network interfaces and addresses is ip.

ip addr
ip addr show eth0

This tells you what IP addresses are assigned to each interface.

If a server has no expected address, that is your first clue something is wrong.

Viewing Routes with ip route

Routing decides where traffic goes.

ip route

Example output may show a default gateway such as:

default via 10.0.0.1 dev eth0

Without a correct default route, the host may reach the local subnet but not the internet or remote networks.

Testing Reachability with ping

ping checks whether a host responds to ICMP echo requests.

ping 8.8.8.8
ping example.com

If ping 8.8.8.8 works but ping example.com fails, the issue may be DNS rather than raw network connectivity.

Note: Some hosts block ICMP, so a failed ping does not always mean the service is down.

Fetching Data with curl and wget

curl is a versatile tool for making HTTP requests and testing APIs.

curl https://example.com
curl -I https://example.com
curl -X GET https://api.example.com/health

-I fetches headers only, which is great for quick checks.

wget is commonly used to download files.

wget https://example.com/archive.tar.gz

Use curl for flexible request testing and wget when your main goal is downloading.

Inspecting Listening Ports with ss and netstat

ss is the modern tool for socket statistics.

ss -tuln
ss -tulpn

Useful flags:

  • -t TCP sockets
  • -u UDP sockets
  • -l listening only
  • -n numeric output, no DNS lookup
  • -p process info

netstat may still appear in older guides:

netstat -tulnp

On newer systems, ss is usually preferred.

Basic Port Scanning with nmap

nmap helps discover open ports and services.

nmap localhost
nmap -p 22,80,443 example.com

Beginners should use it responsibly and only on systems they are authorized to scan.

Tip: Even a basic nmap scan can quickly confirm whether a port is reachable from your current machine.

Remote Access with ssh

ssh is the standard tool for secure remote shell access.

ssh devops@server.example.com
ssh -i ~/.ssh/id_rsa devops@server.example.com

It is the backbone of Linux server administration.

If SSH fails, common causes include DNS issues, firewall rules, wrong keys, or the service not listening on the expected port.

File Transfer with scp and rsync

Use scp for straightforward secure copies.

scp app.conf devops@server:/etc/myapp/
scp devops@server:/var/log/app.log ./

Use rsync for more efficient sync behavior, especially on repeated transfers.

rsync -av ./site/ devops@server:/var/www/site/

rsync copies only changed data, which makes it great for deployments and backups.

/etc/hosts and DNS Resolution

DNS translates names like api.example.com into IP addresses. Linux can also use /etc/hosts for local name overrides.

Example entry:

10.0.0.15 internal-api.local

This is useful for testing or temporary overrides, but it can also create confusion if it points to an outdated address.

A good troubleshooting habit is checking whether a name resolves the way you expect.

A Practical Troubleshooting Flow

Suppose a service is “down.” You could check:

ip addr
ip route
ping api.example.com
curl -I https://api.example.com/health
ss -tulpn | grep 443

That sequence answers key questions:

  • does the host have an IP?
  • can it route traffic?
  • does DNS work?
  • does the web endpoint respond?
  • is anything listening on the expected port?

Test Your Understanding

Let's see how well you understood the concepts! These exercises will help reinforce what you just learned.

Exercise 1: Diagnosing a name-resolution failure

Scenario: ping 8.8.8.8 works, but ping example.com fails.

Question: Based on the lesson, what is the most likely category of problem?

Exercise

Exercise 1: Diagnosing a name-resolution failure

Decide what a working IP ping but failing hostname ping usually points to.

Exercise 2: Inspecting listening services

Question: Which command from the lesson is best for seeing listening TCP and UDP sockets with process information?

Exercise

Exercise 2: Inspecting listening services

Choose the modern socket inspection command with listening and process details.

Exercise 3: Efficient repeated file syncs

Question: Why might rsync be a better fit than scp for sending a site directory to a server again and again?

Exercise

Exercise 3: Efficient repeated file syncs

Identify the advantage rsync provides for repeated transfers.

PreviousPrev
Next

Continue Learning

Linux Users and Groups

Learn how Linux accounts and groups work, and how to manage users, passwords, sudo access, and account files.

15 min·Medium

Linux Process Management

Learn how to inspect, prioritize, background, and control processes in Linux using ps, top, kill, jobs, nohup, and related tools.

20 min·Medium

Linux systemd Basics

Learn how systemd units, targets, systemctl, and journalctl work, and create a simple service unit file.

18 min·Medium

Explore Related Topics

Do

Docker Tutorials

Run and manage containers on Linux

Gi

Git Tutorials

Master Git version control on the command line

Try the Tool

Cron Parser

Parse and validate cron expressions with a visual schedule preview.

Regex Tester

Test and debug regular expressions used in Bash scripts and configs.

On This Page

Why Networking Skills MatterInspecting Interfaces with `ip addr`Viewing Routes with `ip route`Testing Reachability with `ping`Fetching Data with `curl` and `wget`Inspecting Listening Ports with `ss` and `netstat`Basic Port Scanning with `nmap`Remote Access with `ssh`File Transfer with `scp` and `rsync``/etc/hosts` and DNS ResolutionA Practical Troubleshooting FlowTest Your UnderstandingExercise 1: Diagnosing a name-resolution failureExercise 2: Inspecting listening servicesExercise 3: Efficient repeated file syncs