CMD Simulator
Networkingroute

ROUTE Command Guide - Display and Modify IP Routing Table in Windows

Learn how to use the route command to view and modify the IP routing table in Windows. Add, delete, and manage routes for advanced network configuration and troubleshooting.

Rojan Acharya··Updated Mar 17, 2026
Share

The route command is a Windows Command Prompt utility that displays and modifies the IP routing table, which determines how packets are forwarded to their destinations. Use route print to view all routes, route add to add static routes, and route delete to remove routes for multi-network configurations, VPN troubleshooting, and advanced networking.

Whether you're connecting to multiple networks simultaneously, configuring VPN split-tunneling, directing traffic through specific gateways, or diagnosing routing conflicts, mastering the route command gives you control over how Windows forwards IP traffic. Network administrators and IT professionals use route for dual-homed systems, lab environments, and complex network topologies.

This comprehensive guide covers route syntax, all major subcommands (print, add, delete, change), practical examples, troubleshooting tips, related commands, and frequently asked questions. By the end, you'll confidently manage the Windows routing table from the command line.

What Is the Route Command?

The route command has been part of Windows TCP/IP networking since Windows NT. It provides command-line access to the IP routing table—the kernel structure that decides which gateway (or interface) to use when sending packets to a destination IP address. Each route defines a destination network, netmask, gateway, and metric.

When you send traffic to an IP, Windows consults the routing table: it finds the most specific matching route (longest prefix match) and forwards the packet to that route's gateway. The default route (0.0.0.0/0) catches all traffic not matching more specific routes. The route command lets you view and modify this table for advanced scenarios.

The command runs in Command Prompt (CMD), PowerShell, and Windows Terminal. Administrator privileges are required to add, change, or delete routes. Routes added without the -p flag are lost on reboot; use -p for persistent routes.

Route Command Syntax

route [-f] [-p] [command [destination] [mask netmask] [gateway] [metric N] [if interface]]

Parameters and Subcommands

ParameterDescription
printDisplay the routing table
addAdd a route
deleteDelete a route
changeModify an existing route
-fClear all routes (use with caution; use with add to clear before adding)
-pMake route persistent (survives reboot)
destinationNetwork destination (e.g., 0.0.0.0 for default, or specific network)
mask netmaskSubnet mask for destination
gatewayNext-hop gateway IP address
metric NRoute metric (lower = preferred)
if interfaceInterface index or interface number

Parameters and Options Explained

Display Routing Table (print)

Running route print displays the complete routing table including IPv4 and IPv6 routes, interface list, and persistent routes. This is the first step when diagnosing routing issues or planning route additions.

Example – display full routing table:

route print

Output includes:

  • Interface list with interface IDs
  • IPv4 route table (Active Routes and Persistent Routes)
  • IPv6 route table (if applicable)

Example – display only IPv4 routes:

route print -4

Example – display only IPv6 routes:

route print -6

Add Route (add)

The add subcommand adds a new route. Specify destination network, mask, optional gateway, and optional metric. Use -p to make the route persistent across reboots.

Example – add default route:

route add 0.0.0.0 mask 0.0.0.0 192.168.1.1

Example – add persistent route to specific network:

route -p add 192.168.2.0 mask 255.255.255.0 192.168.1.1

Delete Route (delete)

The delete subcommand removes a route. Specify the destination network; the mask is optional if the route is unambiguous.

Example – delete route:

route delete 192.168.2.0

Change Route (change)

The change subcommand modifies an existing route's gateway or metric.

Example – change gateway for route:

route change 192.168.2.0 mask 255.255.255.0 192.168.1.2

Examples

Example 1: View Current Routing Table

Scenario: You need to understand how traffic is being routed before making changes.

Command:

route print

Explanation: Displays all interfaces and routes. Look for "Network Destination" and "Gateway" columns to understand default route and specific network routing.

Example 2: Add Route to Second Network (Dual-Homed)

Scenario: Your computer has two NICs: 192.168.1.x (Ethernet) and 192.168.2.x (Ethernet2). Traffic to 192.168.2.0/24 should go via 192.168.1.1.

Command:

route add 192.168.2.0 mask 255.255.255.0 192.168.1.1

Explanation: Adds a route so traffic to 192.168.2.x is sent via gateway 192.168.1.1. Without this, Windows might use the wrong interface.

Example 3: Add Persistent Route (Survives Reboot)

Scenario: You need to ensure traffic to a specific network always uses a particular gateway, even after reboot.

Command:

route -p add 10.0.0.0 mask 255.0.0.0 192.168.1.1

Explanation: The -p flag makes the route persistent. It will be stored and reapplied on reboot.

Example 4: Add Default Route

Scenario: You need to set or change the default gateway (route for traffic not matching other routes).

Command:

route add 0.0.0.0 mask 0.0.0.0 192.168.1.1

Explanation: 0.0.0.0 with mask 0.0.0.0 is the default route. All traffic to unknown destinations goes to 192.168.1.1.

Example 5: Delete a Route

Scenario: You added a route for testing but it's no longer needed or is incorrect.

Command:

route delete 192.168.2.0

Explanation: Removes the route to 192.168.2.0. Traffic will use the next best matching route (often default).

Example 6: View Only Persistent Routes

Scenario: You want to see which routes will survive a reboot.

Command:

route print

Explanation: The "Persistent Routes" section at the bottom lists routes added with -p. "Active Routes" includes both temporary and persistent.

Example 7: Add Route with Specific Metric

Scenario: You have multiple paths to a network and want to prefer one over another.

Command:

route add 192.168.2.0 mask 255.255.255.0 192.168.1.1 metric 10

Explanation: Lower metric = preferred. If two routes match the same destination, the one with lower metric is used.

Example 8: Change Gateway for Existing Route

Scenario: The gateway for a network has changed; you need to update the route.

Command:

route change 192.168.2.0 mask 255.255.255.0 192.168.1.2

Explanation: Modifies the existing route to use the new gateway. Does not change the destination or mask.

Example 9: Add Host Route (Single IP)

Scenario: You need to route traffic to a single specific IP through a particular gateway.

Command:

route add 203.0.113.50 mask 255.255.255.255 192.168.1.1

Explanation: A /32 mask (255.255.255.255) creates a host route for that single IP only.

Example 10: Clear and Re-add Routes (Advanced)

Scenario: You need to reset routing and add a clean set of routes (use with extreme caution).

Command:

route -f
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1

Explanation: -f clears all routes. You will lose connectivity until you add a default route. Only use in controlled environments.

Common Use Cases

  • Dual-Homed Systems – Add routes so traffic to specific networks uses the correct interface/gateway when a system has multiple network connections.

  • VPN Split Tunneling – Ensure only VPN traffic goes through the VPN gateway by adding routes for corporate networks; other traffic uses default gateway.

  • Lab and Test Environments – Direct traffic to lab networks through a specific router or VM host without affecting production routing.

  • Multi-Network Access – Access devices on a secondary network (e.g., 10.x.x.x) via a gateway on your primary network (192.168.x.x).

  • Troubleshooting Connectivity – Verify that traffic is routed correctly; wrong or missing routes cause "destination unreachable" or connectivity to wrong host.

  • Failover and Redundancy – Use metrics to prefer one path over another; when primary fails, traffic can use the alternate route.

  • Host-Specific Routing – Route traffic to a single IP (e.g., a specific server) through a tunnel or VPN gateway.

  • Persistent Configuration – Use -p for routes that must survive reboots, such as routes to corporate networks or remote sites.

  • Default Gateway Replacement – Change default route when switching networks or when primary gateway is temporarily unavailable.

  • Network Segmentation – Ensure traffic between segments uses the intended gateway for security or compliance.

Tips and Best Practices

  • Run as Administrator – Adding, changing, or deleting routes requires elevated privileges. Right-click Command Prompt → "Run as administrator".

  • Use -p for Permanent Routes – Routes without -p are lost on reboot. For production or critical paths, always use -p.

  • Verify Before Adding – Run route print first to avoid duplicate or conflicting routes. Check existing routes to the same destination.

  • Document Your Routes – Save route print output before making changes: route print > routes-backup.txt. Simplifies rollback.

  • Use Correct Mask – The mask must match the destination network. 192.168.2.0/24 needs mask 255.255.255.0. Wrong mask = wrong routing.

  • Check Interface for Direct Routes – When adding a route to a directly connected network, specify the interface or use the gateway on that segment.

  • Metric Matters – Lower metric = preferred. Default is often 256. Use 10–50 for preferred routes, higher for backups.

  • Test Before Making Persistent – Add route without -p first, verify connectivity, then add with -p if it works.

Troubleshooting Common Issues

"The route addition failed" or "Invalid parameter"

Problem: route add fails with an error.

Solution: Verify syntax: destination, mask, gateway must be valid. Check that gateway is reachable (ping it). Ensure you're running as administrator. Use route add 0.0.0.0 mask 0.0.0.0 <gateway> for default route; order matters.

Prevention: Copy syntax from route /? or this guide.

Route Lost After Reboot

Problem: Route works but disappears after restarting.

Solution: Add the route with -p flag: route -p add .... Non-persistent routes are not saved.

Prevention: Always use -p for routes that must survive reboots.

Traffic Going Wrong Direction

Problem: Packets to a network reach the wrong destination or gateway.

Solution: Run route print and check which route matches your destination. More specific routes (longer prefix) take precedence. Delete incorrect route with route delete <destination> and add correct one.

Prevention: Understand longest-prefix matching; document intended routing before changes.

Route Add Succeeds but No Connectivity

Problem: Route was added but you still can't reach the destination.

Solution: Verify gateway is reachable: ping <gateway>. Ensure gateway can route to destination. Check firewall. Verify destination network and mask are correct.

Prevention: Test gateway connectivity before adding route; verify network topology.

Duplicate Routes or Confusion

Problem: Multiple routes to same destination; unclear which is used.

Solution: Delete unwanted routes: route delete <destination>. Use route print to see all. Lower metric wins when destinations match.

Prevention: Remove obsolete routes; document routing policy.

Related Commands

ipconfig – View IP and Gateway

ipconfig shows your IP address, subnet mask, and default gateway. Use it to confirm gateway IP before adding routes and to verify interface configuration.

ping – Test Reachability

After adding a route, use ping to verify you can reach the destination. If ping fails, check route and gateway.

tracert – Trace Route Path

tracert shows the path packets take. Use it to verify routing is correct and to identify where traffic goes.

netsh – Advanced Routing

netsh interface ipv4 add route provides similar functionality. Use netsh for scripting or when route command syntax is limiting.

pathping – Route with Statistics

pathping combines route tracing with packet loss stats. Use for diagnosing routing issues with latency or loss.

Frequently Asked Questions

What does route print do?

route print displays the IP routing table, including active routes (IPv4 and IPv6), interface list, and persistent routes. It shows how Windows forwards packets to different destinations.

How do I add a default route in Windows?

Use route add 0.0.0.0 mask 0.0.0.0 <gateway-ip>. Replace gateway-ip with your router's IP (e.g., 192.168.1.1). Add -p to make it persistent.

Do I need administrator rights for route?

Viewing with route print works for standard users. Adding, changing, or deleting routes requires administrator privileges.

What is a persistent route?

A persistent route is one saved with the -p flag. It survives reboots and is stored in the registry. Non-persistent routes are lost when the system restarts.

How do I delete a route?

Use route delete <destination>. For example, route delete 192.168.2.0 removes the route to that network. Specify the destination exactly as shown in route print.

What is the route metric?

The metric indicates route preference (cost). Lower values are preferred. When multiple routes match the same destination, Windows uses the one with the lowest metric. Default is often 256.

Can I add a route for a single IP?

Yes. Use a host route: route add <ip> mask 255.255.255.255 <gateway>. The 255.255.255.255 mask means a single host (/32).

Why would I add a static route?

Common reasons: dual-homed systems (multiple networks), VPN split tunneling (send only specific traffic through VPN), lab environments, accessing secondary networks through a gateway, or overriding default routing.

How do I see only IPv4 routes?

Use route print -4 to display only IPv4 routes. Use route print -6 for IPv6 only.

What happens if I use route -f?

route -f clears (deletes) all routes from the routing table. You will lose network connectivity until you add a default route. Use only in controlled environments.

How do I change a route's gateway?

Use route change <destination> mask <mask> <new-gateway>. Example: route change 192.168.2.0 mask 255.255.255.0 192.168.1.2.

Is route the same as netsh?

Both can manage routes. route is simpler for quick changes. netsh interface ipv4 add route is useful for scripting and automation. Functionality overlaps.

Quick Reference Card

CommandPurposeExample
route printDisplay routing tableView all routes
route print -4IPv4 routes onlyFilter output
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1Add default routeSet gateway
route -p add 192.168.2.0 mask 255.255.255.0 192.168.1.1Add persistent routeSurvives reboot
route delete 192.168.2.0Delete routeRemove route
route change 192.168.2.0 mask 255.255.255.0 192.168.1.2Change gatewayUpdate route
route add ... metric 10Set route metricPrefer route

Try Route Yourself

Practice the route command in our interactive Windows Command Simulator to view and manage routing tables safely. Explore our Commands Reference for ipconfig, ping, tracert, and other network tools. For related guides, see ipconfig, tracert, and pathping.

Summary

The route command is a powerful tool for managing the Windows IP routing table. Use route print to view current routes, route add to add static routes, and route delete to remove routes. The -p flag makes routes persistent across reboots—essential for production configurations.

Key use cases include dual-homed systems, VPN split tunneling, lab environments, and accessing multiple networks. Always run as administrator when modifying routes, document changes, and verify connectivity with ping after adding routes. The route command complements ipconfig, ping, and tracert for comprehensive network configuration and troubleshooting.