Linux Networking
Inspect interfaces, test connectivity, and diagnose the network problems behind most production incidents.
Imagine a server that canβt reach another server: no websites, no Docker pulls, no GitHub access, no Kubernetes cluster. Networking is what lets computers communicate β and as a DevOps engineer youβll troubleshoot it almost every day.
π― Learning Objectives
By the end of this lesson you will:
- Understand what networking is
- Find your IP address and hostname
- Inspect network interfaces and routing
- Test connectivity and DNS
- Diagnose common network problems
Your IP Address and Hostname
Every computer has an address and a name:
hostnameβ the computerβs namehostname -Iβ its IP address on the network
Network Interfaces
ip addr # show all network interfaces
ip a # short form of the same commandCommon interfaces youβll see:
| Interface | Meaning |
|---|---|
lo |
Loopback (the machine talking to itself) |
eth0 |
Wired Ethernet |
wlan0 |
Wireless |
Testing Connectivity
Ping tests whether you can reach another machine. Stop it with Ctrl + C.
Then test a domain name β if this works, DNS is resolving correctly:
ping google.comRouting and Open Ports
ip route # where does traffic go? shows the default gateway
ss -tuln # which ports are listening on this machine?The routing table tells Linux where to send network traffic; ss -tuln is invaluable for checking whether your application is actually listening.
Downloading from the Network
curl https://example.com # fetch a URL and print it
wget https://example.com # download a fileThese commands appear constantly in automation scripts.
Real DevOps Example
A deployment fails because the server canβt reach GitHub. The very first check:
That error points straight at DNS β if networking is broken, nothing else matters.
π§ͺ Hands-on Lab
Diagnose Your Network
Run each command and note the output:
hostnameandhostname -Iip addrβ find your active interfaceip routeβ find your default gatewayping 8.8.8.8thenping google.com(Ctrl + C to stop)
Write down your hostname, IP, gateway, and active interface.
π‘ DevOps Tip
Whenever something βdoesnβt work,β first ask: is it a network problem? A huge share of production incidents begin with connectivity or DNS.
β Common Beginner Mistakes
β Ping the IP, then the name
If ping 8.8.8.8 works but ping google.com fails, your connectivity is fine but DNS is misconfigured. Testing an IP and a domain separately instantly narrows down the problem.
π§ Knowledge Check
Which command displays your machine's IP address?
ping 8.8.8.8 succeeds but ping google.com fails. What's the likely problem?
πΌ Interview Preparation
Walk me through how you'd troubleshoot 'the server can't reach the internet'.
Summary
You now understand the networking fundamentals used by Linux servers everywhere β interfaces, IPs, routing, connectivity, and DNS.