Interview Prep/Networking/Addressing, CIDR & Routing

A server has two NICs and traffic to 10.20.0.0/16 is leaving through the wrong one. How do you see and fix the route?

BeginnerScenarioAddressing, CIDR & Routing
Answer

Situation read → Multi-homed Linux hosts use the kernel routing table and the lowest-metric default route wins.

What I'd do →

  1. Run ip route get 10.20.1.5 to see which interface and source IP are used
  2. List all routes with ip route show table all
  3. Add a specific route: sudo ip route add 10.20.0.0/16 via 10.20.0.1 dev eth1
  4. Persist it in netplan or NetworkManager, not only at runtime

Why → Specific routes beat the default route, so a route for the destination prefix on the right interface fixes the problem without touching the default.

Interview tip → Mention that runtime ip route add is lost on reboot, so the real fix lives in config management.

All Networking questions Roadmap: Networking for DevOps

More on Addressing, CIDR & Routing