Hands-on steps to set, verify and persist the default route so outbound traffic reaches the right gateway. 16.11.2025 | reading time: 2 min A default gateway tells a Linux host where to send traffic that doesn't match any more specific route; this short guide shows how to set it live, verify it and make it persistent. Quick demo On a host with eth0 at 192.0.2.10/24 and a gateway 192.0.2.1, check, add and verify a default route with these commands: ```$ ip route show 192.0.2.0/24 dev eth0 proto kernel scope link src 192.0.2.10 ``` Add the default: ```$ sudo ip route add default via 192.0.2.1 dev eth0 ``` Verify the change: ```$ ip route show default via 192.0.2.1 dev eth0 192.0.2.0/24 dev eth0 proto kernel scope link src 192.0.2.10 ``` Make it persistent On modern Ubuntu use a netplan YAML and apply it, for example: ```network: version: 2 renderer: networkd ethernets: eth0: addresses: [192.0.2.10/24] gateway4: 192.0.2.1 nameservers: addresses: [8.8.8.8,8.8.4.4] ``` Then run: ```$ sudo netplan apply ``` On Debian with /etc/network/interfaces add the gateway stanza and restart networking to persist the route. When one gateway is not enough You can set metrics to prefer one gateway over another, replace an existing default with `sudo ip route replace default via GATEWAY dev IF metric N`, and use policy routing (`ip rule` + multiple routing tables) when routes must follow source or port policies. Other helpers to consider NetworkManager (`nmcli`) or systemd-networkd manage persistent routes on desktops and modern servers; legacy tools like `route` still exist but `ip route` is the recommended interface for scripts and automation; use traceroute and ping to validate end-to-end. Wrap-up & next steps You now know how to set a temporary default, make it persistent across distributions and where to look when routes conflict; dive deeper into policy routing and automation to master complex topologies and consider formal study such as CompTIA Linux+ or LPIC-1 for certification preparation with intensive exam training at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. network setup troubleshooting infrastructure