๐ŸŒ Beginner Linux Training ยท Module 10

Networking Basics

Learn how Linux systems communicate using IP addresses, subnets, gateway, DNS, ports, listening services, and basic connectivity testing commands.

This module is designed for trainees who are new to Linux networking and first-level troubleshooting.

Client192.168.1.10
RouterGateway
ServerWeb / App
A network is a path that lets one system send data to another system. Linux gives you commands to inspect, test, and troubleshoot that path.
๐Ÿ Learning progress
0%

๐Ÿ“ฆ The Packet Delivery Story

Think of networking like delivering a parcel. This one mental model connects DNS, IP addresses, routing, ports, and the OSI model.

1

App asks

curl google.com wants a webpage.

2

DNS finds it

DNS resolves the hostname to one or more IP addresses so the client knows which network destination to contact.

3

Linux routes

The route table decides local delivery or gateway.

4

Bits travel

Frames and packets move through LAN, router, or Internet.

5

Port finds app

The destination port selects the service endpoint; ports 80 and 443 are commonly used for HTTP and HTTPS.

6

Server replies

The answer travels back to the client.

๐Ÿง  Visual Memory Anchors

These pictures are deliberately simple. They are meant to be remembered while troubleshooting at a terminal.

๐Ÿ  IP = House Address

Where should the packet go?
The IP identifies the destination system, like a house number identifies a destination.

๐Ÿ˜๏ธ Subnet = Neighborhood

.10
.20
.30
.40
.50
.60
Systems in the same subnet are like houses in the same neighborhood.

๐Ÿšช Gateway = Exit Gate

When the destination is outside your subnet, traffic normally leaves through the default gateway.

๐Ÿ“– DNS = Contact Book

google.com
โ†’ IP address
You remember a name; DNS returns the network address.

๐Ÿข Ports = Numbered Doors

22
SSH
53
DNS
80
HTTP
443
HTTPS
The IP finds the building. The port finds the correct door/application.

๐Ÿ‘‚ Listener = Someone Waiting

๐Ÿง‘โ€โœˆ๏ธwaiting on :22
A listening service is waiting on a local IP/port for incoming connections.

Learning Objectives

๐ŸŽฏ

Understand addressing

Identify what an IP address, subnet, and gateway do in a Linux network.

๐Ÿงญ

Understand name resolution

Explain why google.com needs DNS before the system can connect.

๐Ÿงช

Test connectivity

Use ip, ping, ss, and curl for first-level checks.

Core Concepts

Before troubleshooting networking, trainees must understand these building blocks.

๐Ÿท๏ธ

IP Address

An IP address is a logical address assigned to a network interface or endpoint. Example: 192.168.1.10.

System identificationIPv4: 192.168.1.10IPv6: fe80::1
๐Ÿงฎ

Subnet

A subnet defines which IP addresses are local to your network. Example: 192.168.1.0/24.

In beginner terms, systems like 192.168.1.10 and 192.168.1.20 are usually local to each other in a /24 subnet.

๐Ÿšช

Gateway

A gateway is a next-hop router. For destinations without a more specific route, Linux commonly uses the default gateway/default route.

Example: Your laptop uses 192.168.1.1 to reach the Internet.

๐Ÿ“–

DNS

DNS resolves names to resource records, commonly IPv4 or IPv6 addresses. Example: google.com โ†’ one or more IP addresses.

If an IP ping works but ping google.com reports a name-resolution error, suspect DNS. If the name resolves to an IP but there is no echo reply, ICMP may simply be blocked.

๐Ÿ”Œ

Ports

A port number helps identify a transport-layer service endpoint. The IP identifies the host/interface; the transport protocol plus port helps deliver traffic to the correct socket/service.

PortCommon / conventional service
22SSH
53DNS
80HTTP
443HTTPS
๐Ÿ‘‚

Listening Services

A service is listening when it is waiting for network connections on a port.

Example: SSH server listens on port 22.

Animated OSI Flow: Client to Server

The animation below now runs automatically using CSS. The buttons are optional controls; the packet should move even if you do not click anything.

Accuracy note: The OSI model is a teaching and troubleshooting model. Real TCP/IP implementations do not always map cleanly into separate OSI Layers 5 and 6, so use those layers conceptually rather than assuming each is a distinct Linux component.

Client Sending Data

7. Application
curl, browser, SSH
๐Ÿ“ฆ
6. Presentation
format, encryption
๐Ÿ”
5. Session
session handling
๐Ÿ”
4. Transport
TCP/UDP, ports
๐Ÿšš
3. Network
IP and routing
๐ŸŒ
2. Data Link
MAC, switch
๐Ÿ”—
1. Physical
cable, Wiโ€‘Fi, bits
โšก
Client10.0.0.10
Server172.16.1.20
LAN / Internet
Switch / Gateway / Router
App data TCP port Bits Server app
DATA
Flow running

Data starts at the client application, moves down the client stack, crosses LAN/Internet, then moves up the server stack.

๐Ÿ”Š OSI voice explanation English ยท ready

Server Receiving Data

7. Application
web app receives request
๐Ÿ“ฌ
6. Presentation
decrypt / decode
๐Ÿ”“
5. Session
session matched
๐Ÿ”
4. Transport
port 80 / 443
๐Ÿšš
3. Network
server IP
๐ŸŒ
2. Data Link
local MAC frame
๐Ÿ”—
1. Physical
signal received
โšก
Beginner explanation: what happens when you run curl google.com?
1

Application: curl wants to connect to google.com.

2

DNS: The system asks DNS for the IP address of google.com.

3

Transport: The client opens a TCP connection to a destination port, usually 80 or 443.

4

Network: Linux checks the route table to decide whether to send locally or through the gateway.

5

Data Link / Physical: Data leaves through the network interface using Ethernet or Wiโ€‘Fi.

6

Server: The remote server receives the request and sends a response back.

Linux Networking Command Reference

These are the minimum commands a beginner should know before troubleshooting Linux connectivity.

Show IP addresses

Use this to see interfaces like lo, eth0, ens33, wlan0, and assigned IP addresses.

$ ip a
What to observe

Look for inet for IPv4, inet6 for IPv6, and interface state like UP or DOWN.

Show route table

Use this to find the default gateway and routing path.

$ ip r
What to observe

The line starting with default via shows the gateway used to reach other networks and the Internet.

Ping public IP

This tests ICMP reachability to one specific public IP address without depending on DNS. A failed ping does not by itself prove that Internet access is down.

$ ping 8.8.8.8
What to observe

Success: replies show that IP connectivity likely works. Stop ping using Ctrl+C.

Failure: check the local interface/address, route table, gateway, host/network firewall rules, target filtering, or the upstream network. HTTP proxy settings do not control ICMP ping.

Ping domain name

This tests name resolution and then ICMP reachability to the resolved address. Distinguish a DNS resolution error from a resolved host that simply does not answer ICMP.

$ ping google.com
What to observe

If ping 8.8.8.8 works but ping google.com reports a resolver error such as Name or service not known, suspect DNS. If the hostname resolves but echo replies do not arrive, DNS may be fine.

Optional DNS-only check:

$ getent ahosts google.com

This asks the system name-service stack for address records without depending on ICMP echo replies.

Show listening services

Use this to see TCP/UDP ports that local services are listening on.

$ ss -tulnp
What to observe

t = TCP, u = UDP, l = listening, n = numeric, p = process.

Use sudo ss -tulnp if process details are hidden.

Test HTTP using curl

Use this to test whether an application-level HTTP request works.

$ curl google.com
What to observe

You may see HTML, redirect output, or a message telling you the site has moved. For headers only, use:

$ curl -I https://www.google.com

Hands-on Lab: Basic Network Inspection

Run these commands on a Linux VM. The goal is not to memorize output, but to learn what each command proves.

Lab 1: Check IP address

$ ip a

Task: Identify your active interface and write down its IPv4 address.

Lab 2: Check default gateway

$ ip r

Task: Find the default via line.

Lab 3: Test public-IP ICMP reachability

$ ping 8.8.8.8

Task: Check whether your system receives ICMP echo replies from this public IP address.

Lab 4: Test DNS

$ ping google.com

Task: Compare this result with ping 8.8.8.8. If you need to separate DNS from ICMP behavior, also try getent ahosts google.com.

Lab 5: Check listening ports

$ ss -tulnp

Task: Identify at least two listening ports and the local addresses they bind to.

Beginner notes

127.0.0.1:port means local only. 0.0.0.0:port means all IPv4 interfaces. :::port usually means IPv6 interfaces.

Lab 6: Test web access

$ curl google.com

Task: Verify whether your system can make an HTTP request from the terminal.

Beginner Troubleshooting Flow

Use this simple decision path when a Linux machine cannot reach the network.

Scenario A: Internet not working

1. Check interface
ip a โ€” Does the interface have an IP?
2. Check route
ip r โ€” Is there a default gateway?
3. Check IP reachability
ping 8.8.8.8 โ€” Can the system reach a public IP?
4. Check DNS
ping google.com โ€” Can the system resolve names?
5. Check application
curl google.com โ€” Does HTTP work?

Scenario B: Service not reachable

1. Is service running?
Check service status or process list.
2. Is service listening?
ss -tulnp โ€” Is the expected port open?
3. Is it bound correctly?
127.0.0.1 means local only; 0.0.0.0 means all IPv4 interfaces.
4. Is firewall blocking?
Check host firewall and network firewall rules.
5. Is DNS/name correct?
Try IP address directly, then hostname.
SymptomLikely AreaFirst Command
No IP addressInterface / DHCP / static configip a
No default routeGateway / route configip r
IP ping works, hostname gives resolution errorDNSping google.com
Server reachable but app failsPort / service / firewallss -tulnp
Browser fails but ping worksHTTP/HTTPS/proxy/application layercurl -I https://example.com

Trainer Notes

Recommended delivery sequence

1

Explain IP, subnet, gateway using a home Wiโ€‘Fi or office LAN example.

2

Run ip a and ip r live on a Linux VM.

3

Compare ping 8.8.8.8 and ping google.com.

4

Use ss -tulnp to explain ports and listening services.

5

Use OSI animation to connect commands with networking layers.

Common beginner mistakes

Mistake: Thinking IP address and hostname are the same thing.

Mistake: Assuming ping failure always means Internet is down. ICMP may be blocked.

Mistake: Ignoring gateway when external connectivity fails.

Mistake: Seeing a service on 127.0.0.1 and expecting remote systems to connect to it.

๐ŸŽฏ Networking Field Missions

Run each mission on a Linux VM. Tick it only when you can explain what the result proves. Progress is saved locally in your browser.

MISSION 1

๐Ÿชช Find your identity

$ ip a

Find the active interface and its IPv4 address.

MISSION 2

๐Ÿšช Find the exit

$ ip r

Find the default route and gateway.

MISSION 3

๐ŸŒŽ Test raw reachability

$ ping 8.8.8.8

Observe replies, latency, and packet loss. Remember ICMP may be blocked.

MISSION 4

๐Ÿ“– Test DNS

$ ping google.com

Compare this with the IP-only ping.

MISSION 5

๐Ÿ‘‚ Inspect listeners

$ sudo ss -tulnp

Find one TCP listener and explain its bind address.

MISSION 6

๐ŸŒ Test the application

$ curl -I https://www.google.com

Find the HTTP status line and headers.

๐Ÿ•ต๏ธ Real-World Troubleshooting Challenges

Choose the strongest next action based on the evidence โ€” not a random command.

Ticket #1 โ€” Name resolution failure

ping 8.8.8.8 works. ping google.com fails to resolve the name.

Ticket #2 โ€” App works only locally

ss -tulnp shows 127.0.0.1:8080.

Ticket #3 โ€” No external connectivity

ip a looks normal, but ip r has no default route.

Ticket #4 โ€” Ping fails, web works

Browser and curl work normally, but the host does not reply to ping.

๐Ÿง  Click-to-Flip Recall Cards

Try to answer in your head first, then click the card.

What does ip a answer?

Click to reveal

Interfaces + IP addresses

Also inspect interface state.

Gateway in one sentence?

Click to reveal

Normal next hop to other networks

Usually shown as default via.

DNS in one sentence?

Click to reveal

Name โ†’ IP resolution

Hostname lookup before connecting.

Port 22?

Click to reveal

SSH

Common SSH server port.

Listener on 127.0.0.1?

Click to reveal

Localhost only

Remote systems normally cannot connect directly.

Why curl after ping?

Click to reveal

Application-level evidence

curl can exercise DNS, TCP, TLS and HTTP.

IP
Identity
Subnet
Neighborhood
Gateway
Exit path
DNS
Name lookup
Port
App door
Listener
Waiting app

Knowledge Check

Click an answer to check understanding.

1. Which command shows the IP address of Linux interfaces?
2. What does DNS do?
3. If ping 8.8.8.8 works but ping google.com reports a name-resolution error, what is the likely problem?
4. Which command shows listening TCP/UDP services?
5. In the OSI model, which layer is mainly responsible for IP routing?

One-page Lab Sheet

Commands to practice:

$ ip a $ ip r $ ping 8.8.8.8 $ ping google.com $ ss -tulnp $ curl google.com

Ask trainees to write what each command proves: IP configuration, gateway route, ICMP reachability to a public IP, DNS resolution, listening services, and application-level web access.

โ†‘