Lesson 09 — Linux Networking
Lesson 09 — Linux Networking
Section titled “Lesson 09 — Linux Networking”Lesson Overview
Section titled “Lesson Overview”Almost every Linux server communicates with other systems over a network.
Whether you’re:
- Accessing a website
- Connecting to an AWS EC2 instance using SSH
- Deploying Kubernetes clusters
- Downloading software updates
- Accessing cloud storage
- Connecting to a database
Linux networking makes it all possible.
As a Cloud Engineer, DevOps Engineer, Linux Administrator, or Cybersecurity Professional, you’ll spend a significant amount of your time troubleshooting network connectivity, configuring interfaces, verifying DNS resolution, and monitoring traffic.
In this lesson, you’ll learn the Linux networking fundamentals that are used daily in enterprise environments.
Learning Objectives
Section titled “Learning Objectives”After completing this lesson, you will be able to:
- Understand Linux network interfaces.
- View and configure IP addresses.
- Understand routing and gateways.
- Configure DNS.
- Test network connectivity.
- Troubleshoot networking issues.
- Use common Linux networking commands.
Linux Networking Overview
Section titled “Linux Networking Overview”Every Linux server connects to a network using one or more Network Interfaces.
A network interface allows Linux to send and receive data.
Example:
Linux Server
↓
Network Interface
↓
Switch
↓
Router
↓
InternetWithout a network interface, a server cannot communicate with other devices.
Network Interfaces
Section titled “Network Interfaces”Modern Linux systems use predictable interface names.
Common examples:
eth0
ens33
ens160
enp0s3
wlan0Cloud platforms often use names such as:
ens5
eth0Viewing Network Interfaces
Section titled “Viewing Network Interfaces”Display all interfaces.
ip link showor
ip linkExample output:
lo
ens33Viewing IP Addresses
Section titled “Viewing IP Addresses”Display IP configuration.
ip addror
ip aExample:
ens33
192.168.1.100/24This command replaces the older ifconfig utility.
Understanding IP Address Information
Section titled “Understanding IP Address Information”Example:
192.168.1.100/24Where:
- 192.168.1.100 = IP Address
- /24 = Subnet Prefix
This identifies the host on the local network.
Loopback Interface
Section titled “Loopback Interface”Linux always includes the Loopback Interface.
loLoopback IP:
127.0.0.1Purpose:
- Local communication
- Application testing
- Service verification
Viewing Routing Information
Section titled “Viewing Routing Information”Display routing table.
ip routeExample:
default via 192.168.1.1The default gateway sends traffic destined for external networks.
Default Gateway
Section titled “Default Gateway”The default gateway forwards traffic outside the local network.
Example:
Linux Server
↓
Gateway
192.168.1.1
↓
InternetWithout a default gateway, Internet connectivity is not possible.
DNS Configuration
Section titled “DNS Configuration”Linux stores DNS configuration in:
/etc/resolv.confExample:
nameserver 8.8.8.8Display DNS settings.
cat /etc/resolv.confHostname Configuration
Section titled “Hostname Configuration”Display hostname.
hostnameDisplay detailed hostname information.
hostnamectlChange hostname.
sudo hostnamectl set-hostname web-serverTesting Connectivity
Section titled “Testing Connectivity”Ping another device.
ping google.comPing an IP address.
ping 8.8.8.8Successful replies indicate network connectivity.
Tracing Network Paths
Section titled “Tracing Network Paths”View the path packets take.
Ubuntu:
traceroute google.comIf not installed:
sudo apt install tracerouteThis command helps identify routing issues.
Testing DNS Resolution
Section titled “Testing DNS Resolution”Use nslookup.
nslookup gohackerscloud.comOr:
dig gohackerscloud.comInstall if required.
sudo apt install dnsutilsThese tools verify DNS functionality.
Viewing Open Ports
Section titled “Viewing Open Ports”Display listening services.
ss -tulnExample output:
22
SSH
80
HTTP
443
HTTPSThe ss command replaces the older netstat utility.
Using netstat
Section titled “Using netstat”Some enterprise systems still use:
netstat -tulnInstall if required.
sudo apt install net-toolsTesting HTTP Connectivity
Section titled “Testing HTTP Connectivity”Retrieve a webpage.
curl https://www.gohackerscloud.comView only headers.
curl -I https://www.gohackerscloud.comcurl is widely used for testing APIs and web services.
Downloading Files
Section titled “Downloading Files”Use wget.
wget https://example.com/file.txtThis downloads files directly from the command line.
Checking Active Connections
Section titled “Checking Active Connections”Display active network connections.
ss -tunapThis command helps identify active clients and services.
Viewing Network Statistics
Section titled “Viewing Network Statistics”Display interface statistics.
ip -s linkUseful information includes:
- Packets Sent
- Packets Received
- Errors
- Dropped Packets
Restarting Network Services
Section titled “Restarting Network Services”Ubuntu (NetworkManager):
sudo systemctl restart NetworkManagerUbuntu Server (systemd-networkd):
sudo systemctl restart systemd-networkdRestart networking after configuration changes if required.
Linux Networking in Cloud Computing
Section titled “Linux Networking in Cloud Computing”Cloud Engineers regularly configure networking on Linux virtual machines.
Examples:
AWS EC2
- Private IP
- Elastic IP
- Security Groups
- Route Tables
Azure Virtual Machine
- Virtual Network
- Network Security Groups
Google Compute Engine
- VPC Network
- Firewall Rules
Linux networking knowledge is essential for cloud administration.
Linux Networking in Kubernetes
Section titled “Linux Networking in Kubernetes”Every Kubernetes node relies on Linux networking.
Examples include:
- Pod Communication
- Cluster Networking
- CNI Plugins
- DNS Resolution
- Service Discovery
Networking issues are among the most common Kubernetes troubleshooting scenarios.
Linux Networking in Cybersecurity
Section titled “Linux Networking in Cybersecurity”Security professionals investigate:
- Open ports
- Unauthorized connections
- DNS anomalies
- Packet loss
- Suspicious outbound traffic
- Remote access sessions
Many security investigations begin with Linux networking commands.
Common Networking Commands
Section titled “Common Networking Commands”Display interfaces:
ip linkDisplay IP addresses:
ip addrDisplay routing table:
ip routeDisplay hostname:
hostnamectlPing host:
ping google.comDNS lookup:
dig gohackerscloud.comDisplay listening ports:
ss -tulnDownload webpage:
curl https://www.gohackerscloud.comDownload file:
wget URLReal-World Example
Section titled “Real-World Example”A Cloud Engineer deploys an application to an Ubuntu server.
After deployment, users cannot access the website.
The engineer investigates using the following workflow:
Check IP Address
↓
ip addr
↓
Verify Default Gateway
↓
ip route
↓
Test DNS
↓
dig gohackerscloud.com
↓
Check Web Server
↓
systemctl status nginx
↓
Verify Port 443
↓
ss -tuln
↓
Website RestoredThis structured troubleshooting process is commonly used in enterprise environments.
Best Practices
Section titled “Best Practices”As a Linux administrator:
- Use
ipinstead of deprecated networking tools where possible. - Assign meaningful hostnames.
- Verify DNS configuration after deployment.
- Monitor open ports regularly.
- Remove unused network services.
- Document IP addressing schemes.
- Restrict unnecessary inbound ports using firewalls.
- Test connectivity after every network change.
Good networking practices improve reliability, security, and maintainability.
Key Takeaways
Section titled “Key Takeaways”After completing this lesson, you should understand:
- Linux network interfaces.
- IP address configuration.
- Routing and default gateways.
- DNS configuration.
- Network troubleshooting commands.
- Open ports and active connections.
- Linux networking in cloud and enterprise environments.
Summary
Section titled “Summary”Linux Networking is a core skill for every IT professional.
Whether you’re deploying cloud infrastructure, managing enterprise servers, troubleshooting applications, or investigating cybersecurity incidents, you’ll rely on Linux networking commands every day.
By mastering interfaces, IP addressing, DNS, routing, and troubleshooting tools, you’ll be well prepared to administer Linux systems in AWS, Azure, Google Cloud, Kubernetes, and enterprise data centers.
Next Lesson
Section titled “Next Lesson”➡️ Lesson 10 — Linux Storage & Disk Management
In the next lesson, you’ll learn how Linux manages disks, partitions, file systems, mounting, storage devices, and logical volume management (LVM), and discover how enterprise Linux servers handle persistent storage.