COMMAND
routeView and edit the IP routing table
route shows and edits the routing table that decides where a Windows machine sends each packet. route print displays it; route add and route delete change it. The default route (0.0.0.0) sends everything not matched by a more specific entry to the default gateway.
Purpose
Every packet a host sends is matched against its routing table to decide the next hop. route displays that table and lets you add or remove entries, which is occasionally necessary for VPNs, multi-homed machines, or reaching a subnet through a specific router.
Reading the table
route printIPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.37 35
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
192.168.1.0 255.255.255.0 On-link 192.168.1.37 291
192.168.1.255 255.255.255.255 On-link 192.168.1.37 291
===========================================================================| Column | Meaning |
|---|---|
| Network Destination / Netmask | The block this route covers (see subnet mask) |
| Gateway | Next hop, or "On-link" for directly attached networks |
| Interface | Which local address sends the traffic |
| Metric | Lower wins when routes overlap |
The 0.0.0.0 / 0.0.0.0 line is the default route.
How a route is chosen
- Longest prefix match: the most specific matching route wins. A packet to 10.1.2.3 prefers 10.1.0.0/16 over 10.0.0.0/8.
- Lowest metric breaks ties between equally specific routes.
Adding and removing routes
Reach 10.0.0.0/8 through a router at 192.168.1.254, permanently:
route -p add 10.0.0.0 mask 255.0.0.0 192.168.1.254Remove it:
route delete 10.0.0.0Both require an elevated prompt. Use the Subnet Calculator to derive the mask from a CIDR block.
Common mistakes
- Forgetting
-pand losing the route at reboot. - Wrong mask, so the route is more or less specific than intended.
- A gateway that is not on-link, which the system rejects because it cannot ARP for an address outside the interface's subnet.
- Leftover manual routes silently redirecting traffic; audit with
route print.
PowerShell equivalent
Get-NetRoute lists routes as objects; New-NetRoute -DestinationPrefix 10.0.0.0/8 -NextHop 192.168.1.254 -InterfaceIndex N adds one using CIDR; Remove-NetRoute deletes.
Frequently asked questions
How do I make a route permanent?
Add -p: route -p add 10.0.0.0 mask 255.0.0.0 192.168.1.254. Without -p, the route is lost at the next reboot. Persistent routes are stored in the registry and shown separately in route print.
What is the 0.0.0.0 route?
The default route. With mask 0.0.0.0 it matches every destination not covered by a more specific route, sending it to the gateway. A machine with two default routes uses the one with the lower metric.
Why is my traffic taking the wrong path?
A more specific route, a lower metric, or a leftover manual route is winning. route print shows all of them; longest-prefix match then lowest metric decides.