Learn to read and change Linux routing tables to steer packets where you need them. 16.11.2025 | reading time: 3 min Routing decides where packets go; changing the routing table changes your network's behavior instantly and can solve reachability, redundancy, or segmentation problems. A small network puzzle A server has two NICs, eth0 on 192.168.1.0/24 and eth1 on 192.168.2.0/24, and the default gateway is 192.168.1.1; the task is to send traffic to 10.0.2.0/24 via the router at 192.168.2.1 without altering firewall rules. Show and do: add a route Inspect current routes, add a specific route, then verify the change with the following commands and outputs: ``` $ ip route show default via 192.168.1.1 dev eth0 proto static metric 100 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.10 192.168.2.0/24 dev eth1 proto kernel scope link src 192.168.2.10 $ sudo ip route add 10.0.2.0/24 via 192.168.2.1 dev eth1 $ ip route show default via 192.168.1.1 dev eth0 proto static metric 100 10.0.2.0/24 via 192.168.2.1 dev eth1 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.10 192.168.2.0/24 dev eth1 proto kernel scope link src 192.168.2.10 ``` Modify, delete, replace To change an existing entry use `ip route replace`, to remove it use `ip route del`, and to make complex decisions use additional routing tables with `ip rule` and `ip route add table <n>`; remember that `ip` manipulates kernel state only, so changes are ephemeral unless persisted in distro configuration or NetworkManager. Edge cases and persistence Policy routing is powerful: source-based routes, multiple default routes with metrics, and VRF namespaces are common in complex setups; on Debian/Ubuntu put routes into /etc/network/interfaces or create a systemd-networkd file, while NetworkManager users can use `nmcli` or connection keyfiles to persist routes. Quick checklist Always inspect `ip route show` and `ip rule show` before changes, test connectivity with `ping` or `traceroute`, and keep a rollback command ready `ip route del` so the network can be restored quickly. Next steps Try creating a routing table for a VPN interface, add a rule matching a source subnet, and observe how packets follow alternate tables; mastering these skills makes troubleshooting and design far easier. Join Bits & Bytes Academy First class LINUX exam preparation. network utilities troubleshooting infrastructure