Linux › Module 4 › Lesson 2
ping, traceroute, netstat
Test connectivity with ping, traceroute, and inspect sockets
Opening
Silence is not a tombstone
Beginners treat ping as a life detector: reply means alive, timeout means dead. Defenders and operators both know better. ICMP echo can be dropped by a firewall while SSH on port 22 still answers. The opposite also happens: ping works, the web port is filtered. This lesson is reachability and listening sockets on systems you own. ping and traceroute are diagnostic. ss and netstat show what your box is offering. Scanning other people's networks without permission is not a lab — it is unauthorized access. Keep every probe aimed at localhost, your own VM, or hosts you explicitly own.
1. ICMP echo: what ping actually proves
ping sends ICMP Echo Request and waits for Echo Reply. A reply with a time in milliseconds says: this host (or something impersonating it on path) answered that ICMP, and a path existed in both directions for those packets. That is all. It does not prove HTTP is up, SSH is allowed, or the host is "secure."
No reply has several innocent explanations: host powered off, wrong IP, local NIC down, ICMP disabled, a middlebox dropping echo, or your own firewall. Windows and many cloud security groups default to blocking ICMP. ping -c 4 127.0.0.1 should work on a healthy Linux box because you are asking yourself. If localhost ping fails, debug your own stack before you accuse the internet.
Ctrl+C stops a continuous ping. On Linux, ping runs until interrupted unless you pass -c. Flood ping (-f) and huge packet sizes against other networks are abuse, not troubleshooting. For Cyberlium practice: ping 127.0.0.1, ping ::1 if IPv6 loopback matters, and optionally ping another address on a machine you own (for example a second NIC IP you just read with ip a). Do not ping-sweep dorm floors.
2. traceroute hops, then ss/netstat listeners
traceroute (or tracepath, or mtr) maps hops by sending probes with increasing TTL. Each router that decrements TTL to zero should send Time Exceeded; the destination should send a final response. Stars (* * *) mean that hop did not answer the probe — often a policy, not a black hole for all traffic. traceroute to the public internet from school networks may be filtered; that is normal. Prefer tracing to a destination you own, or simply practice reading sample output without probing strangers.
ss (modern) and netstat (legacy) show sockets. ss -tulpn lists TCP/UDP listening sockets with processes (root may be needed for some process names). Look for Local Address: 127.0.0.1 means bound to loopback only; 0.0.0.0 or * means all IPv4 interfaces; :: may mean all IPv6. That distinction decides whether a service is reachable from other hosts.
netstat -tulpn is the older spelling of the same idea when net-tools is installed. Prefer ss on modern systems. Established connections (ss -tan) show conversations already in progress — useful on your box, creepy on someone else's. Save a snapshot under $HOME/cyberlium-lab so you can compare after you start a local web server later in the module.
3. Reading results without false certainty
Combine tools carefully: ping localhost OK + ss shows ssh on 0.0.0.0:22 means SSH is offered to the network path that can reach you. ping fail + browser works to a site means ICMP is filtered, not that "the internet is down." traceroute stars at hop 5 do not authorize you to attack hop 5. Diagnostics are for understanding YOUR path and YOUR listeners.
Legal and ethical line (repeat until boring): your VM, WSL, home lab gear you own, or an explicitly authorized cyber range. Not: campus scanners against the /16, not: neighbor Wi-Fi, not: "the whole 10.0.0.0/8 for homework." If an assignment needs multi-host practice, use VMs you create and interconnect yourself.
When ping to a second owned host fails, check ip a and ip route on both sides, firewalls you control, and whether the guest is on NAT isolation. Fix configuration; do not escalate into unauthorized scanning "to find what is alive."
4. Wrong vs right: diagnose owned hosts, not strangers
Failure mode — ping/traceroute as a stealth scan of networks you do not own. Right diagnostics stay home:
Wrong
ping -f a classmate's laptop. traceroute every gateway on campus for a screenshot. nmap the school /24 because "ping is too slow." Flood ping a public website. Assume timeout means "hack it next." Run ss on a shared jump host and harvest other users' connections for gossip.
Right
ping -c 4 127.0.0.1 and document success. Optionally ping another IP on a machine you own. Use traceroute/tracepath only toward destinations you own or that policy allows. Run ss -tulpn on your VM and note loopback vs wildcard binds. Save outputs under $HOME/cyberlium-lab/m04-ping. Treat filtered ICMP as normal, not as a hunting license.
5. Practical: localhost ping and your own listeners
Create a lab folder, capture ping to 127.0.0.1, capture ss -tulpn (or netstat), and write one sentence about a listener bound to 127.0.0.1 versus 0.0.0.0. Skip any target that is not yours.
Safe reachability + socket inventory on YOUR box
# YOUR VM / WSL / owned hosts only — no scanning strangers
mkdir -p "$HOME/cyberlium-lab/m04-ping"
cd "$HOME/cyberlium-lab/m04-ping" || exit 1
# ICMP to yourself (must-work baseline on healthy Linux)
ping -c 4 127.0.0.1 | tee ping-localhost.txt
# Optional IPv6 loopback
ping -c 2 ::1 2>/dev/null | tee ping-v6-localhost.txt || true
# Optional: ping ANOTHER address YOU own (example: IP from `ip a` on THIS machine)
# MY_IP=$(ip -4 -br a | awk '/UP/ && $1!="lo"{print $3; exit}' | cut -d/ -f1)
# [ -n "$MY_IP" ] && ping -c 2 "$MY_IP" | tee ping-self-nic.txt
# Hop map — only if you have an owned destination; otherwise skip
# traceroute -n 127.0.0.1 | tee traceroute-localhost.txt
tracepath -n 127.0.0.1 2>/dev/null | tee tracepath-localhost.txt || true
# Listening sockets on THIS host
ss -tulpn > ss-tulpn.txt 2>/dev/null || ss -tuln > ss-tuln.txt
# Legacy alternative if present:
# netstat -tulpn > netstat-tulpn.txt 2>/dev/null || true
{
echo "ping localhost: see ping-localhost.txt"
echo "Listeners: 127.0.0.1 = local only; 0.0.0.0/* = all IPv4 ifaces"
echo "ICMP fail ≠ host dead; firewalls drop echo often"
} > notes.txt
cat notes.txt
head -n 30 ss-tulpn.txt 2>/dev/null || head -n 30 ss-tuln.txt
# NEVER:
# ping -f or floods against others
# traceroute/nmap campus or coffee-shop LANs
# "alive host discovery" on networks you do not ownMission: prove localhost, inventory listeners
1) ping -c 4 127.0.0.1 on your VM/WSL and save the output under $HOME/cyberlium-lab/m04-ping. 2) Run ss -tulpn (or ss -tuln) and note one listening port; say whether it binds to 127.0.0.1 or a wildcard. 3) Write one sentence: why ping timeout does not prove a host is powered off. 4) Do not probe hosts or networks you do not own.
Stuck? Ask Cyberlium AI Mentor
If ss columns look like alphabet soup, ask Cyberlium AI Mentor for a hint — not a scan cheat sheet. Try: "Hint only: in ss -tuln how do I tell a 127.0.0.1 bind from 0.0.0.0?" Paste only your own sanitized lines from your lab folder.
You now treat ping as ICMP evidence only, read traceroute stars without panic, and use ss/netstat to see what YOUR machine is listening on — including the critical loopback-versus-wildcard bind. Next — wget, curl, ssh — moves from reachability to intentional transfers and remote shells on hosts you are allowed to use.
Knowledge Check
APPLY: ping to a web server times out, but https:// that server loads in your browser. Best interpretation?
Multiple choice
Knowledge Check
APPLY: ss shows a process listening on 127.0.0.1:8080 on your VM. What does that bind mean?
Multiple choice
Knowledge Check
APPLY: True or False: If ping to 127.0.0.1 works, you are authorized to traceroute-scan every host on your school LAN for practice.
True or False