During system boot or network restart routines on Ubuntu servers and desktop workstations, administrators can encounter a red error banner stating Failed to start Flush Routing Tables, corresponding to the failure of networkd-dispatcher.service or systemd network table teardown scripts. This service is responsible for clearing dynamic kernel IP routing tables during network reconfiguration to prevent packet routing loops and orphaned gateway metrics. When the service crashes, network interfaces can become desynchronised, losing default gateway pointers. This breakdown stems from Netplan syntax errors, duplicate default gateways, or interface name mismatches.
Examine Detailed systemd Failure Journal Logs
Querying the system journal isolates whether the failure is caused by an invalid Netplan YAML parameter, an unreachable next-hop gateway, or permissions errors.
- Open a terminal on your Ubuntu system.
- Query the status of the network flushing service:
systemctl status systemd-networkd.service - Inspect journal logs specifically for routing table errors:
journalctl -b -u systemd-networkd.service --no-pager | grep -i route - Look for failure indicators such as
RTNETLINK answers: File exists,Nexthop has invalid gateway, orFailed to configure Route: Network is unreachable.
Audit Netplan Configuration for Duplicate Gateways
In modern Ubuntu installations, defining gateway4 or duplicate default routes across multiple network interfaces in Netplan files causes kernel routing table flush errors.
- Navigate to the Netplan directory:
cd /etc/netplan - Inspect your configuration files:
cat *.yaml - Ensure that
gateway4(deprecated in modern Netplan) is replaced with canonicalroutesdirectives. - Verify that only one interface defines a default route (
to: defaultorto: 0.0.0.0/0). Having two default routes without distinctmetricvalues causes routing conflicts. - Test your Netplan configuration for syntax validity without permanently applying changes:
sudo netplan try - If no syntax errors are returned, apply the configuration:
sudo netplan apply
Manually Flush Orphaned Kernel Routing Rules
If transient routing table states have become trapped in the running Linux kernel, flushing the IP route cache manually resets the routing tables.
- List current active IPv4 routes:
ip route show - Flush all cached route entries:
sudo ip route flush cache - If duplicate default gateways exist, remove the invalid gateway manually:
sudo ip route del default via [Invalid-IP-Address] - Restart the systemd network daemon:
sudo systemctl restart systemd-networkd - Verify that the service now passes cleanly without failure banners:
sudo systemctl status systemd-networkd