C.W.K.
Stream
Lesson 10 of 12 · published

Gateway & Routing

~15 min · gateway, routing, traceroute, mtr

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

The default gateway

Your default gateway is the router that connects your local subnet to everything else. Any packet whose destination isn't in your local subnet gets handed to the gateway, which forwards it onward. On a typical home network, that's 192.168.1.1 or 192.168.0.1, set automatically by DHCP.

The route table

Every device has a routing table — a small set of rules answering "for this destination, which interface and gateway?" The two rules that matter most:

  • Local subnet — "For 192.168.1.0/24, send out en0 directly to the device" (no gateway needed; ARP finds the MAC).
  • Default route — "For anything else, send to the gateway and let it figure it out."

Traceroute — every hop, exposed

traceroute reveals the chain of routers between you and a destination. It's the diagnostic tool when "the internet feels slow" or "this site is down for me but not for everyone."

Each line of output is one hop. Asterisks (* * *) mean a router didn't reply to probes — usually because it's configured to silently drop ICMP rate-limited probes, not because there's a problem. Real packet loss shows as missing replies on multiple hops in a row.

mtr is traceroute's better cousin: live-updating, with cumulative loss/latency stats per hop. Reach for it whenever you're diagnosing path issues to a specific destination.

Code

View your routes·bash
# Full routing table (macOS / BSD)
netstat -rn

# Just the default route (macOS)
route -n get default

# Linux
ip route show

# Typical macOS output:
#   default            192.168.1.1        UGScg          en0
#   192.168.1.0/24     link#13            UCS            en0
Trace and live-monitor a path·bash
# Standard traceroute
traceroute github.com

# Use ICMP (more friendly through some firewalls)
sudo traceroute -I github.com

# Live-updating, cumulative stats per hop
mtr github.com

# Non-interactive report — paste this in a bug report or to your ISP
mtr --report -c 100 github.com

External links

Exercise

Install mtr (brew install mtr) and run mtr github.com. Let it accumulate ~30 cycles. Identify: (a) your gateway as hop 1, (b) the first hop that's outside your network (your ISP's first router), (c) any hop with non-trivial loss. Then run mtr --report -c 100 github.com to get a static snapshot you could share. Notice how report mode is what you'd attach to a support ticket.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.