Manipulate network routing tables. Route packets of network traffic from one subnet to another by modifying the route table.
Syntax
Display route details:
ROUTE [-f] [-4|-6] PRINT [destination_host] [MASK subnet_mask_value] [gateway]
[METRIC metric] [IF interface_no.]
Add a route:
ROUTE [-f] [-4|-6] [-p] ADD [destination_host] [MASK subnet_mask_value] [gateway]
[METRIC metric] [IF interface_no.]
Change a route:
ROUTE [-f] [-4|-6] CHANGE [destination_host] [MASK subnet_mask_value] [gateway]
[METRIC metric] [IF interface_no.]
Delete a route:
ROUTE [-f] [-4|-6] DELETE [destination_host] [MASK subnet_mask_value] [gateway]
[METRIC metric] [IF interface_no.]
Key
-f Clear (flush) the routing tables of all gateway entries. If this is
used in conjunction with one of the commands, the tables are
cleared prior to running the command.
destination_host
The address (or set of addresses) that you want to reach.
-p Create a persistent route - survives system reboots.
-4 Force using IPv4
-6 Force using IPv6
subnet_mask_value
The subnet mask value for this route entry.
This defines how many addresses are there.
If not specified, it defaults to 255.255.255.255.
gateway The gateway.
interface The interface number (1,2,...) for the specified route.
If the option `IF interface_no` is not given, ROUTE will try
to find the best interface available.
metric The metric, ie. cost for the destination.
Note that routes added to the table are not made persistent unless the -p switch is specified. Non-persistent routes only last until the computer is rebooted.
Symbolic names used for Destination_Host are looked up in the network database file NETWORKS.
The symbolic names for gateway are looked up in the host name database file HOSTS.
If the command is PRINT or DELETE. Destination or gateway can be a wildcard ('*'), or the gateway argument can be omitted.
An IP address mask of 0.0.0.0 means everything. (rather like the *.* wildcard). In other words it says: When matching this pattern, don’t worry about matching any of the bits - everything matches.
If Destination_Host 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.
Example wildcards:
157.*.1
157.*
127.*
*224*
Pattern match is only allowed in the PRINT command.
C:\> route PRINT
C:\> route PRINT -4
C:\> route PRINT -6
C:\> route PRINT 157* ... only prints those matching 157*
C:\> route ADD 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF 2
Destination^ ^Gateway Metric^ ^
Interface^
C:\> route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 2 IF 2
CHANGE is used to modify gateway and/or metric only.
C:\> route DELETE 157.0.0.0
C:\> route DELETE 3ffe::/32
“Get your kicks on ROUTE 66” ~ Jack Kerouac.
NETSTAT-rn - Display TCP/IP network connections, routing and protocol statistics.
TRACERT - Trace route to a remote host.
Equivalent bash command (Linux): ip route - Manipulate route table entries.