Networking Fundamentals

Learn Linux networking basics including IP addresses, ports, DNS, localhost, and network troubleshooting.

Learn how Linux systems communicate over networks, how applications connect to each other, and how modern infrastructure moves data across the internet.


Difficulty: Beginner
Estimated reading time: 60 min


Introduction

Modern computing is built on networking.

When you:

  • open a website
  • connect through SSH
  • use Docker
  • access an API
  • stream a video
  • connect to a database

you are using networking.

Linux powers most of the modern internet.

That means understanding Linux networking is critical for:

  • DevOps
  • servers
  • Docker
  • Kubernetes
  • cloud infrastructure
  • cybersecurity
  • backend development

Networking may initially feel intimidating because there are many concepts:

  • IP addresses
  • ports
  • DNS
  • routing
  • protocols
  • interfaces

But underneath, networking is simply:

Systems communicating with each other.


What Is a Network?

A network is a group of devices capable of communicating.

Examples:

Network Type Example
Home network Your Wi-Fi
Office network Company infrastructure
Datacenter network Cloud servers
Internet Global interconnected network

Devices communicate by exchanging data packets.


Clients and Servers

Most networking follows a client-server model.

Example:

Browser → Website Server
Role Responsibility
Client Sends requests
Server Responds with data

Examples:

Client Server
Browser Web server
SSH client SSH server
Docker client Docker daemon
API consumer API backend

What Is an IP Address?

Every device on a network needs an identifier.

This identifier is called:

An IP address.

Example:

192.168.1.15

An IP address works similarly to a home address.

It tells the network:

Where data should go.


IPv4

The most common IP format:

192.168.1.15

This is called:

IPv4

IPv4 uses four numbers separated by dots.

Each section ranges from:

0-255

Public vs Private IP Addresses

There are two major IP categories.


Public IP

A public IP is accessible from the internet.

Example:

203.0.113.10

Public IPs are used by:

  • cloud servers
  • websites
  • internet-facing infrastructure

Private IP

Private IPs are used inside local networks.

Examples:

192.168.x.x
10.x.x.x
172.16.x.x

Your home devices usually use private IPs.

Routers translate private traffic into public internet traffic.

This process is called:

NAT (Network Address Translation)


Checking Your IP Address

Useful command:

ip addr

Example output:

inet 192.168.1.15/24

This displays network interfaces and addresses.


Understanding Network Interfaces

A network interface is how Linux connects to a network.

Examples:

Interface Purpose
eth0 Ethernet
wlan0 Wi-Fi
lo Loopback interface

The Loopback Interface

One of the most important interfaces:

lo

This is the loopback interface.

Associated IP:

127.0.0.1

Usually called:

localhost


What Is localhost?

localhost refers to:

Your own machine.

Example:

curl localhost

This sends a network request back to your own computer.

No external network is involved.


Why localhost Matters

Developers constantly use localhost for:

  • testing applications
  • local APIs
  • databases
  • Docker containers
  • development servers

Examples:

localhost:3000
localhost:8080
localhost:5432

Understanding Ports

An IP address identifies a machine.

A port identifies a specific application on that machine.

Example:

192.168.1.10:80

Breakdown:

Part Meaning
192.168.1.10 Machine
80 Application port

Ports allow multiple applications to share one IP address.


Common Ports

Port Service
22 SSH
80 HTTP
443 HTTPS
3306 MySQL
5432 PostgreSQL
6379 Redis
8080 Alternative web apps

You will memorize many of these naturally over time.


Example: Web Server

Imagine Nginx runs on:

192.168.1.10:80

Browser request:

http://192.168.1.10

The browser connects to:

  • IP address of the machine
  • port 80 for HTTP traffic

What Is DNS?

Humans prefer names:

google.com

Computers use IP addresses.

DNS translates names into IP addresses.

Example:

google.com → 142.250.74.14

DNS acts like the internet’s phonebook.


Testing DNS

Useful command:

nslookup google.com

or:

dig google.com

These commands resolve domain names into IP addresses.


Understanding Protocols

Networking communication follows rules called:

Protocols.

Examples:

Protocol Purpose
HTTP Websites
HTTPS Secure websites
SSH Remote shell access
FTP File transfers
TCP Reliable transport
UDP Fast lightweight transport

Protocols define how devices communicate.


TCP vs UDP

One of the most important networking concepts.


TCP

TCP is:

  • reliable
  • connection-oriented
  • ordered

Used for:

  • websites
  • SSH
  • databases
  • APIs

TCP prioritizes reliability.


UDP

UDP is:

  • faster
  • lightweight
  • connectionless

Used for:

  • gaming
  • video streaming
  • VoIP
  • DNS queries

UDP prioritizes speed.


Understanding HTTP Requests

When visiting a website:

Browser
DNS lookup
Connect to server IP
Open TCP connection
Send HTTP request
Receive response

This entire process often happens in milliseconds.


The ping Command

Tests network connectivity.

Example:

ping google.com

Output:

64 bytes from ...

ping checks:

  • connectivity
  • latency
  • packet loss

Very useful for troubleshooting.

Stop with:

Ctrl + C

Understanding Latency

Latency measures:

How long data takes to travel.

Usually measured in:

milliseconds (ms)

Lower latency means faster communication.


The curl Command

One of the most important Linux networking tools.

Example:

curl https://example.com

This sends an HTTP request directly from the terminal.

Very common in:

  • APIs
  • DevOps
  • debugging
  • automation

Testing Local Applications

Example:

curl localhost:3000

This checks whether a local application is responding.

Extremely useful during development.


Downloading Files with wget

Example:

wget https://example.com/file.zip

This downloads files directly from the terminal.

Very common on servers.


Viewing Open Ports

One of the most useful Linux networking commands:

ss -tuln

Example output:

LISTEN 0 128 0.0.0.0:80

This shows active listening ports.


Understanding Listening Ports

When applications wait for network connections, they:

Listen on ports.

Example:

Nginx listens on port 80
SSH listens on port 22

Applications open sockets and wait for incoming traffic.


Older Alternative: netstat

Older systems often used:

netstat -tuln

Modern Linux usually prefers:

ss

because it is faster and more efficient.


Understanding Firewalls

Linux systems often use firewalls to control network access.

Firewalls decide:

  • which ports are accessible
  • which traffic is allowed
  • which traffic is blocked

Common Linux firewall tools:

Tool Description
ufw Beginner-friendly
iptables Advanced
nftables Modern replacement

Example: Allow SSH

sudo ufw allow 22

This allows SSH traffic.


Example: Block Web Traffic

sudo ufw deny 80

This blocks HTTP traffic.


Understanding SSH

SSH is one of the most important Linux networking technologies.

SSH allows secure remote access.

Example:

ssh user@server

This creates an encrypted terminal session over the network.

Most Linux servers are managed remotely through SSH.


Real-World Example: Hosting a Website

Imagine a Linux web server.


Incoming Request Flow

Browser
DNS resolves domain
Traffic reaches public IP
Firewall allows port 443
Nginx receives HTTPS request
Application responds

This is real production networking.


Docker and Networking

Docker heavily relies on Linux networking concepts.

Containers use:

  • virtual interfaces
  • internal IP addresses
  • bridges
  • port forwarding

Example:

docker run -p 3000:3000 app

This maps:

Host port → Container port

Understanding Linux networking makes Docker networking dramatically easier.


Why Networking Feels Difficult

Networking combines many layers:

  • hardware
  • operating systems
  • protocols
  • routing
  • security
  • applications

At first this feels overwhelming.

But most Linux networking eventually becomes understanding:

Who talks to whom, through what port, using which protocol.


Linux Networking Philosophy

Linux exposes networking very transparently.

You can inspect:

  • interfaces
  • sockets
  • routes
  • DNS
  • connections
  • ports
  • packets

This level of visibility is one reason Linux dominates servers and infrastructure.


The Bigger Picture

Networking is the foundation of:

  • the internet
  • cloud systems
  • APIs
  • Docker
  • Kubernetes
  • distributed systems

Once you understand networking basics, modern infrastructure suddenly becomes much easier to understand.

Almost everything in DevOps eventually becomes:

Processes communicating over networks.


What Comes Next

In the next chapter, we will explore:

  • package managers
  • software installation
  • repositories
  • apt
  • dnf
  • pacman
  • dependency management

This is where Linux starts becoming a real software platform.