Linux: Diagnose and Replace a Bad Default Route
Local traffic works, but the default route points to the wrong gateway. Inspect route selection and replace it. Work through it yourself in the live host terminal below.
Symptom
Local traffic works, but the default route points to the wrong gateway. Inspect route selection and replace it.
Your mission
Inspect, recover, then verify
Format
Linux shell
Investigate before you configure.
Use the CLI evidence to isolate the fault, make the smallest safe correction, then verify the network state changed.
Observe the symptom and link state.
Diagnose by comparing the protocol evidence.
Verify the expected device state and confirm the original symptom is resolved.
Console access: Linux
This workspace stacks for portrait phones. Rotate to landscape for the full split-screen console.
Need a hint?
Reveal the root cause when you're ready.
Try the investigation first, then use this as your escape hatch, not a dead end.
Lab debrief
Turn the session into a repeatable troubleshooting pattern.
Use this reference after your attempt: first explain the symptom, then verify the evidence, then confirm the repair.
The problem
The host reaches 10.20.30.0/24 but sends all other traffic to nonexistent gateway 10.20.30.254.
What you'll practice
- Display the main routing table
- Ask the kernel which route it would use
- Replace a default route
- Verify the selected next hop
The topology
One Linux host sits on 10.20.30.0/24. The real router is 10.20.30.1, but a temporary route points at .254.
Commands to run yourself
The real diagnostic commands for this lab, copy-paste ready. Run these in the same order to reproduce the investigation on your own session.
ip route showip route get 203.0.113.20Topology diagram
Fact-checked references
The commands and behaviour in this lab were checked against these primary references.
Frequently asked
Why use replace instead of add?
Add fails if an equivalent route already exists. Replace changes an existing route or adds it if absent.
Will this survive reboot?
No. Persist the gateway with the system's network configuration after validating the live change.
Ready to run this lab yourself?
No setup, no image sourcing. Book a session or ask for a live demo.