Networking Fundamentals
Networks move data between devices using packet switching. Learn the essentials of addressing, routing and the tools every DevOps engineer uses to inspect them.
What is this?
A computer network connects devices so they can share data and services. Data travels in small units called packets, each carrying a source and destination address. Hosts on the same local network talk directly over their shared link, while routers forward packets hop by hop between networks.
Why do you need it?
- Every cloud service, container and CI pipeline runs on top of a network — networking knowledge underpins all of DevOps.
- You cannot debug connectivity, latency or security issues without understanding how packets get from A to B.
- Designing VPCs, subnets, load balancers and service meshes assumes core networking concepts.
- Network tools such as ping, traceroute, curl and ss are the first stop in most production incidents.
Mental model
The postal service
Packet-switched networking
You drop a letter in a box with a destination address. It travels through sorting offices (routers) hop by hop until it reaches the mailbox that matches the address. Packets do the same, but in milliseconds and without reserving a fixed route.
How it works
- Each device gets a unique IP address so senders and receivers can be identified.
- Data is broken into packets; every packet carries the source and destination IP plus metadata.
- Hosts on the same LAN deliver packets directly; anything outside the LAN is handed to the default gateway (router).
- Routers inspect each packet's destination address and forward it to the next hop, one link at a time.
- The destination reassembles the packets into the original data and delivers it to the application.
A packet's journey from one host to another across routers.
Key commands
ip addr showList all network interfaces and their assigned IP addresses.
ip routeShow the routing table, including the default gateway.
ping -c 4 8.8.8.8Send 4 ICMP echo requests to verify reachability and measure latency.
traceroute example.comShow every router hop between you and the destination.
ss -tulpnList listening TCP/UDP sockets and the processes behind them.
Examples
Verify connectivity with ping
$ ping -c 4 8.8.8.8PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=12.4 ms64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=12.1 ms64 bytes from 8.8.8.8: icmp_seq=3 ttl=117 time=12.3 ms --- 8.8.8.8 ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time 2002msping sends ICMP echo requests (RFC 792). Replies prove the host is reachable; the TTL shows how many router hops the packet survived and the round-trip time is latency. Use ping first whenever anything feels slow or unreachable.
In production
- Latency and packet loss between regions drive topology decisions in multi-region deployments.
- Round-trip time from ping becomes the baseline for detecting network saturation or DDoS.
- ip addr and ip route are the standard first checks when a container, VM or host has no connectivity.
- Understanding LAN versus routed traffic explains why two services in one VPC talk directly while cross-VPC traffic traverses gateways.
Best practices
- Work top-down: ping the loopback, then the gateway, then the public internet.
- Use hostnames in tooling but confirm the resolved IP matches the expected endpoint.
- Check both directions — outbound from a host and inbound to it — before blaming the network.
- Document your network layout (subnets, gateways, firewalls) so incidents are faster to triage.
Common mistakes
- Pinging a hostname and getting a cached or wrong IP from a broken DNS setup.
- Assuming packet loss means the network — switches, firewalls and rate limiting can all drop packets.
- Forgetting that ICMP is often blocked by firewalls, so ping fails while TCP works fine.
- Checking connectivity only from your workstation instead of from the affected server itself.
Common issues
ping: connect: Network is unreachableNo route to the destination — usually a missing or wrong default gateway.
Run ip route and confirm a default route exists; add one with ip route add default via <gateway-ip> dev eth0.
Destination Host UnreachableThe gateway has no path to the host, or the host's firewall drops ARP or ICMP.
Verify the gateway is up (ip route) and that the target host's firewall permits the traffic.
100% packet loss but the host still answers curlICMP echo is blocked by a firewall while TCP is allowed.
Test reachability with a TCP tool instead, e.g. nc -vz host 443 or curl -sI https://host.
Debugging tips
- Start with ip addr and ip route on the affected host before touching anything else.
- Use ping with a packet count and interpret loss together with latency.
- Compare traceroute results from two vantage points to isolate the failing hop.
- Use ss -tulpn to confirm a service is actually listening on the expected port.
Interview checkpoint
Hands-on lab
- List network interfaces and their IP addresses
- Read the routing table and find the default gateway
- Verify reachability with ping
- Distinguish name resolution from network failure
Inspect Your Network and Verify Connectivity
20 min · beginner
Quick quiz
Which device forwards packets between different networks?
What does the destination IP address in a packet identify?
A router can deliver a packet directly to any host on the internet without intermediate hops.
Cheat sheet
ip addr showInterfaces and IP addressesip routeRouting table and default gatewayping -c 4 <host>ICMP reachability + latencytraceroute <host>Every hop along the pathss -tulpnListening sockets and processesping 127.0.0.1Is my own stack alive?ping <gateway>Can I reach my router?ping <public-ip>Do I have internet?ping <hostname>Does DNS resolve?