Pcornel
Linux · Linux Networking

Default Gateway

Cheat sheet · https://pcornel.dk/topic.php?topic=2778

Back to the Topic

Answer

The default gateway is the route for 0.0.0.0/0 (and ::/0): where packets go when no more specific route matches.

Remember

Only one default route should normally be active per address family, or set clear metrics. The gateway must be on a directly connected subnet. IPv6 often learns its default route from router advertisements.

First checks

  • ip -br addr — interfaces and addresses
  • ip route — routing table and default route
  • ip neigh — ARP/neighbour cache
  • ip route get <dest> — route, interface and source chosen for a destination
  • nmcli device status / networkctl — which tool manages each interface

Commands

ip route add default
ip neigh show 10.110.0.1
ping -c 3 10.110.0.1
ip rule add from 10.0.20.5 table 200

Verify in this order

default route configured or learned → gateway on a connected subnet → ARP/ND resolves it → off-subnet packets forwarded

Where it usually breaks

First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2778

Confirmation

Confirm action

Continue?