The route command is used to manually configure the routes in a routing table.
Availability
Route is an external command that is available for the following Microsoft operating systems as route.exe.
Availability
Route syntax
Route examples
Windows 95
Windows 98
Windows ME
Windows 2000
Windows XP
Windows Vista
Windows 7
Windows 8
Windows 10
Windows 11
Route syntax
Windows Vista and later syntax
ROUTE [-f] [-p] [-4|-6] command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]
All symbolic names used for destination are looked up in the network database file NETWORKS. The symbolic names for gateway are looked up in the hostname database file HOSTS.
- Windows Vista and later syntax.
- Windows XP and earlier syntax.
If the command is PRINT or DELETE the destination or gateway can be a wildcard (asterisk ‘*’), or the gateway argument may be omitted.
If Dest contains a * or ?, it is treated as a shell pattern and only matching destination routes are printed. The ‘’ matches any string, and ‘?’ matches any one char. Examples: 157..1, 157., 127., 224.
Pattern match is only allowed in PRINT command.
Diagnostic Notes:
Invalid MASK generates an error, that is when (DEST & MASK) != DEST. Example> route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1 The route addition failed: The specified mask parameter is invalid. (Destination & Mask) != Destination.
Windows XP and earlier syntax
ROUTE [-f] [-p] command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]
PRINT Prints a route. ADD Adds a route. DELETE Deletes a route. CHANGE Modifies an existing route destination.
If the command is PRINT or DELETE, the destination or gateway can be a wildcard (asterisk ‘*’), or the gateway argument may be omitted.
If Dest contains a * or ?, it’s treated as a shell pattern, and only matching destination routes are printed. The ‘’ matches any string, and ‘?’ matches any one char. Examples: 157..1, 157., 127., 224.
Route examples
route PRINT
rout ADD 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF2 ^destination ^mask ^gateway ^metric ^interface
When IF is not given, it tries to find the best interface for the gateway.
route PRINT route PRINT 157* …. Only prints those matching 157* route DELETE 157.0.0.0 route PRINT
One way to use this would be as follows: You can’t ping the server that you are connecting to, but you know the IP address to be 127.16.16.10.
Interface List0x1 ……………………… MS TCP Loopback interface0x2 …00 14 a4 c3 44 20 …… Xircom CardBus Ethernet 10/100 Adapter0x3 …00 b0 d0 43 55 a5 …… 3Com EtherLink PCI0x4 …00 01 b0 8f 8f 80 …… NdisWan Adapter
Active Routes:Network Destination Netmask Gateway Interface Metric0.0.0.0 0.0.0.0 127.16.8.14 127.16.8.14 1127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1127.16.0.0 255.255.0.0 127.16.8.14 127.16.8.14 1127.16.8.14 255.255.255.255 127.0.0.1 127.0.0.1 1192.168.50.0 255.255.255.0 192.168.50.65 192.168.50.65 2192.168.50.65 255.255.255.255 127.0.0.1 127.0.0.1 1192.168.50.255 255.255.255.255 192.168.50.65 192.168.50.65 1224.0.0.0 224.0.0.0 127.16.8.14 127.16.8.14 1224.0.0.0 224.0.0.0 192.168.50.65 192.168.50.65 1255.255.255.255 255.255.255.255 192.168.50.65 192.168.50.65 1
Notice that no gateway for the current IP goes to 255.255.255.0, so it must be added. Now enter the following command.
route ADD 127.16.0.0 MASK 255.255.255.0
METRIC 1
Next, enter the following command:
route print
Active Routes:Network Destination Netmask Gateway Interface Metric0.0.0.0 0.0.0.0 127.16.8.14 127.16.8.14 1127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1127.16.0.0 255.255.0.0 127.16.8.14 127.16.8.14 1** 127.16.0.0 255.255.255.0 127.16.8.14 127.16.8.14 1127.16.8.14 255.255.255.255 127.0.0.1 127.0.0.1 1192.168.50.0 255.255.255.0 192.168.50.65 192.168.50.65 2192.168.50.65 255.255.255.255 127.0.0.1 127.0.0.1 1192.168.50.255 255.255.255.255 192.168.50.65 192.168.50.65 1224.0.0.0 224.0.0.0 127.16.8.14 127.16.8.14 1224.0.0.0 224.0.0.0 192.168.50.65 192.168.50.65 1255.255.255.255 255.255.255.255 192.168.50.65 192.168.50.65 1
Notice the ** IP address gives me the default gateway.
Related information
- See our gateway, IP address, and route definitions for further information and related links on these terms.