Routing basics
Core idea
Routing decides where packets go:
- Same subnet → send directly (ARP/ND)
- Different subnet → send to a gateway (router)
View routes
ip route
ip -6 route
route -n # legacy
Default route
Typically looks like:
default via 192.168.1.1 dev eth0
Add / delete routes (temporary)
sudo ip route add 10.10.0.0/16 via 192.168.1.254
sudo ip route del 10.10.0.0/16
Policy routing (mention)
Advanced setups may use multiple routing tables and rules:
ip rule
ip route show table all
Troubleshooting tips
- Confirm default route exists and points to reachable gateway
- Use
traceroute to see path
- Check firewall/NAT on the gateway if outbound works but inbound fails