Lesson 2 of 18 · 20m
Routing and ICMP: Every Hop Decides for Itself
Longest-prefix matching, ip route get as the real answer, and why traceroute asterisks mean 'didn't introduce itself,' not 'traffic stops here.'
traceroute prints six hops, then asterisks all the way down — and the service you're probing answers instantly. If hops 7 through 30 are "broken," why is the connection fine? Because nothing was broken. Each asterisk is just a router that declined to write you a postcard; the packet itself kept moving. Understanding what a router actually does — and what ICMP is for — is what separates "the network is weird" from a one-command answer.
There is no path, only decisions
The wrong mental model: your connection "takes a route" the way a train takes a track — set up once, followed end to end. There is no setup. Every router, including your own kernel, looks at exactly one field — the destination IP — and picks the longest-prefix match in its forwarding table, per packet, forever. Your outbound packets can flow through Ashburn while the replies come back through Chicago; asymmetric routing is normal and breaks nothing. This also means there is no "connection" for a middlebox to own — only packets that each hop decides to forward or drop.
Read your own table first:
ip route
# default via 10.0.0.1 dev eth0 proto dhcp metric 100
# 10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.15Two lines, two rules: traffic for 10.0.0.0/24 goes straight out eth0 (the destination is on the local link — ARP it directly), everything else goes to the gateway 10.0.0.1. Longest prefix wins, always: add a /32 static for one host and it beats both of these. And the diagnostic nobody teaches:
ip route get 8.8.8.8
# 8.8.8.8 via 10.0.0.1 dev eth0 src 10.0.0.15 uid 1000That answers the question you're actually asking on a multi-homed box: which source IP, which interface, which next hop. When a VPN adds routes and things "randomly" break, ip route get is the sixty-second way to see which table entry won. If src surprises you, your mDNS/NAT/firewall assumptions downstream are already wrong.
Your kernel only ever reaches the next hop
Layer 2 addressing stops at the gateway. Your machine does not ARP for 8.8.8.8 — it ARPs for 10.0.0.1, wraps the packet in a frame addressed to the gateway's MAC, and the router strips that frame and repeats the process. ip neigh shows the ARP/NDP cache: 10.0.0.1 dev eth0 lladdr 52:54:00:... REACHABLE. When "ping the gateway" fails but the interface is up, this table — not the routing table — is where you look. It's also the L2 attack surface: ARP has no authentication, gratuitous ARP poisons the whole LAN's cache, and that is still how most local man-in-the-middle works.
ICMP is the error channel, not just ping
ICMP exists to report what IP itself cannot: this destination is unreachable (type 3, with codes — port unreachable is how a closed UDP port answers), this packet's TTL expired (type 11), slow down, this route is better (type 5, redirect — disabled on sane hosts via net.ipv4.conf.all.accept_redirects=0, because it's a spoofing primitive). Two of those types power everything you use:
- ping = echo request (type 8) / echo reply (type 0). A
Destination Host Unreachablemeans the local ARP lookup failed or a router sent back unreachable-with-code; a silent timeout means something dropped the packet and told nobody. - traceroute = TTL as a probe. Send packets with TTL 1, 2, 3...; each hop decrements and the one that hits zero is supposed to mail back ICMP time-exceeded, naming itself. GNU traceroute defaults to UDP on high ports; Windows'
tracertuses ICMP echo;traceroute -T -p 443sends TCP SYNs to a port that's likely allowed through the firewall — use it when the UDP probes die at the border.
traceroute -nT -p 443 api.example.com # TCP probes, no DNS lookups
tracepath -n api.example.com # no root needed; also prints pmtuThe asterisks: a hop that forwards your packet but doesn't generate a time-exceeded. Routers rate-limit ICMP generation (control-plane policing is expensive and attacker-shaped), some firewalls drop it, and MPLS tunnels hide interior hops entirely unless icmp tunneling is on. Asterisks mean "this hop didn't introduce itself." They never mean "traffic stops here" — the proof is that your SYN still lands.
The practice
Block all ICMP on a firewall and you break Path MTU Discovery (next lesson) and all of IPv6, where packet too big is mandatory — filter by type, not the protocol. For diagnosis: ip route get for the local decision, ping for liveness, traceroute/mtr for where the replies stop, ip neigh when even the gateway is silent. Four commands, each answering a different layer. Pick the one that matches the layer that's actually failing.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
What is a Web Server? Apache, Nginx, and How the Internet Delivers Web Pages
A web server accepts HTTP requests and returns responses. Apache has been doing this since 1995. Nginx rebuilt the model in 2004 and took over the cloud. Here's how they work, how they differ, and how to pick between them.
How to Install NGINX on Debian & Ubuntu: Server Blocks, HTTPS and Reverse Proxy
When it comes to running a web server for all of my online projects, NGINX is the first that comes to mind for me. By default, it follows my guidelines of running a piece of software – meaning that the software is security-minded, performance-driven, and honestly, really easy to manage all the aspects of it. NGINX is most likely the most popular web server software in the world, and it's well known for being the backbone of some of the biggest sites on the internet to date. It is a lightweight
Minecraft 26.4 Replaced Its Decade-Old Login Crypto. Here's What key-rotation-period-seconds Actually Does.
26.4 Snapshot 9 rewrote how a Java Edition client and server agree on an encryption key. RSA-1024 is out, X25519 is in, and a new key-rotation-period-seconds setting decides how often the server's key changes. I opened the snapshot server jar, timed the login crypto, and checked what changes for...
The Same Researcher Broke apt the Same Way Twice, Seven Years Apart
In 2019 Max Justicz showed apt would install a package an attacker swapped in over a redirect. In November 2026 he did it again, CVE-2026-109518, through a different door that ends in the same place: code as root from a man in the middle. The fix shows how apt reuses files on disk.