Network Config · Lesson 2 of 5
route
0 / 4 checkpoints answered
Manual routes alter how the kernel selects an outgoing interface and next hop. A mistake can disconnect the host or redirect sensitive traffic, so inspect the effective route, configuration owner, and recovery path before changing state.
Inspecting the Current Decision
Record relevant routes and ask the kernel how it currently reaches the destination:
$ ip -4 route show
$ ip route get 192.168.2.25
Also inspect policy rules and alternate tables when present. The route lookup is local evidence; it does not send traffic.
CheckWhy run ip route get DESTINATION before a route change?
press 1/2/3 to answer · → next lesson
Adding or Replacing a Route
Add a route to the canonical prefix through a reachable next hop:
$ sudo ip route add 192.168.2.0/23 via 10.11.12.3 dev enp1s0
The gateway must be reachable according to the relevant link or an explicit valid on-link design. add fails when an equivalent route already exists. replace creates or changes a route, which is useful for idempotent configuration but can overwrite working state; preview the exact target first.
CheckWhat commonly happens if ip route add targets a route that already exists?
press 1/2/3 to answer · → next lesson
Deleting Precisely
Delete the exact route attributes when more than one candidate or table could exist:
$ sudo ip route del 192.168.2.0/23 via 10.11.12.3 dev enp1s0
A destination-only deletion can match more broadly than intended or be ambiguous. Capture the original command needed to restore the route before removing it.
CheckWhy include next hop and device when deleting a route?
press 1/2/3 to answer · → next lesson
Persistence and Remote Safety
An ip route command changes current kernel state only. NetworkManager, systemd-networkd, netplan, ifupdown, DHCP, routing daemons, or orchestration may later replace it. Store the route in the active owner only after testing runtime behavior.
For a remote host, preserve an independent console and use a rollback that does not depend on the route being changed. Then verify route lookup, neighbor state, both traffic directions, and the real service.
CheckWhat can happen to a manually added route after a network-manager reload?
press 1/2/3 to answer · → next lesson
Summary
You can now make a scoped Linux route change with a recoverable workflow.
- Capture current routes, rules, and effective lookup.
- Use a canonical prefix and reachable next hop.
- Distinguish add from deliberate replacement.
- Delete the exact route and preserve a restore command.
- Persist through the active manager and verify both directions.
Lesson complete
You finished route. Nice work — keep the momentum going.