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 →
- Run
ip route get 10.20.1.5to see which interface and source IP are used - List all routes with
ip route show table all - Add a specific route:
sudo ip route add 10.20.0.0/16 via 10.20.0.1 dev eth1 - 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.
More on Addressing, CIDR & Routing
You own 10.0.0.0/16 for a new VPC and need separate /24 subnets for dev, QA and prod across two AZs. How do you carve it up?BeginnerA host is configured as 192.168.1.130/25. What network does it belong to and what is the broadcast address?BeginnerHow many usable IPs does an AWS subnet of /28 have?BeginnerA route table has 10.0.0.0/16 -> local and 10.0.1.0/24 -> vpn-gw. Where does a packet to 10.0.1.5 go?BeginnerA newly built server can ping everything in its subnet but nothing outside. What is the first thing you check?BeginnerYou are picking a private range for a new company network. Which RFC 1918 range do you choose and why?Beginner