Windows: remove all routes, including persistent ones
route and reg delete commands to clear the routing table and persistent routes.
To clear the routing table, including persistent routes added with route -p, run these commands from an elevated prompt.
Commands
route /f
reg delete HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes /va /f
route /fclears the routing table of all gateway entries.- The
reg deletecommand removes every value underPersistentRoutes, where Windows stores the persistent routes.
Notes
- Clearing the routing table can cut network connectivity, including the current remote session. Prefer
route delete <destination>to remove a single route. - Reboot or restart the network adapter to rebuild the default routes.