Back to Learning
Linux · NetworkingBeginner

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.

Interactive simLinuxiproute2RoutingGateway

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

Linux: Diagnose and Replace a Bad Default Route

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.

Locked

Sign up with your email to open Linux: Diagnose and Replace a Bad Default Route, free. You get the root cause and the full step-by-step fix.

No spam. The fix lands in your inbox too. Signing up includes 4 guided labs free, tracked against your email. After that, the Learning Pass unlocks every remaining lab.

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.

Show routes
ip route show
Show selected path
ip route get 203.0.113.20

Topology 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.