


How to use the route command to manage the IP routing table in Windows
Jul 31, 2025 am 08:24 AMTo use the route command of Windows, you must first run the command prompt as an administrator; 1. Use route print to view the current route table, and you can add IPv4, IPv6 or IP mode filter; 2. Use route add to add static routes, specify the target network, subnet mask, gateway, optional interface and number of hops, and add the -p parameter to make the route still valid after restarting; 3. Use route change to modify the gateway or hop of the existing route, but cannot modify the route automatically generated by the system; 4. Use route delete to delete the route of the specified target, without entering a mask or gateway; before the operation, you should use route print to verify the current route, be cautious when modifying the default gateway, incorrect configuration may lead to network interruption, static routes are suitable for multi-network servers or specific gateway connection scenarios, and administrator permission is required for operation.
The route
command in Windows is a built-in command-line utility that allows you to view and modify the IP routing table. This is useful for troubleshooting network connectivity, directing traffic through specific gateways, or adding static routes for remote networks. Here's how to use it effectively.

View the Current Routing Table
To see the current routing table, open Command Prompt as an administrator and run:
route print
This displays all active routes, including:

- Network Destination – the target network or host
- Netmask – the subnet mask
- Gateway – the next-hop IP address
- Interface – the local IP address of the network interface
- Metric – the cost of the route (lower is preferred)
You can also filter the output:
-
route print IPv4
– show only IPv4 routes -
route print IPv6
– show only IPv6 routes -
route print 192.168.*
– show routes matching a pattern
Add a Static Route
Use route add
to manually insert a route into the table. This is helpful when you want traffic to a specific network to go through a particular gateway.

Syntax:
route add <destination> mask <subnet_mask> <gateway> metric <metric> if <interface>
Example: To send traffic for the 10.10.5.0/24 network through gateway 192.168.1.1 on interface 192.168.1.100:
route add 10.10.5.0 mask 255.255.255.0 192.168.1.1 metric 2 if 10002
Note: The
if
parameter is optional. If omitted, Windows chooses the best interface. You can find interface numbers from theroute print
output under the "Interface" list.
To make the route persistent across reboots , add the -p
flag:
route -p add 10.10.5.0 mask 255.255.255.0 192.168.1.1
?? Persistent routes are stored in the Windows registry and restored at startup.
Modify or Change an Existing Route
Use route change
to update a route's gateway or metric.
Syntax:
route change <destination> mask <subnet_mask> <new_gateway> metric <metric>
Example:
route change 10.10.5.0 mask 255.255.255.0 192.168.1.2
Note: You cannot change persistent routes without the
-p
flag if they were added as persistent. Also,route change
won't work on routes automatically created by Windows (like default or interface-specific routes).
Delete a Route
Use route delete
to remove a route from the table.
Syntax:
route delete <destination>
Example:
route delete 10.10.5.0
You don't need to specify the subnet mask or gateway—just the destination network or host.
This removes both temporary and persistent routes, but persistent routes will reappear after reboot unless you delete them while they're active or manually clean the registry.
Common Tips and Warnings
- Always run Command Prompt as Administrator – route commands require elevated privileges.
- Use
route print
before and after changes to verify results. - Be cautious with the default gateway (0.0.0.0). Incorrect changes can break internet access.
- Interface numbers (used with
if
) are listed inroute print
under the "Interface List". - Static routes are often used in multi-homed servers or when connecting to remote private networks via a specific gateway.
Using the route
command gives you fine-grained control over how Windows forwards packets. While most home users rely on automatic routing via DHCP, static routes are essential in enterprise or complex network environments. Just remember: with great power comes great responsibility—double-check your commands.
The above is the detailed content of How to use the route command to manage the IP routing table in Windows. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The problem of slow booting can be solved by the following methods: 1. Check and disable unnecessary booting programs; 2. Turn off the quick boot function; 3. Update the driver and check disk health; 4. Adjust the number of processor cores (only for advanced users). For Windows 11 systems, first, the default self-start software such as QQ and WeChat are disabled through the task manager to improve the startup speed; if you use dual systems or old hardware, you can enter the power option to turn off the quick boot function; second, use the device manager to update the driver and run the chkdsk command to fix disk errors, and it is recommended to replace the mechanical hard disk with SSD; for multi-core CPU users, the kernel parameters can be adjusted through bcdedit and msconfig to optimize the startup efficiency. Most cases can be corrected by basic investigation

If you're having trouble reading your desktop icons' text or simply want to personalize your desktop look, you may be looking for a way to change the font color on desktop icons in Windows 11. Unfortunately, Windows 11 doesn't offer an easy built-in

Fixed Windows 11 Google Chrome not opening Google Chrome is the most popular browser right now, but even it sometimes requires help to open on Windows. Then follow the on-screen instructions to complete the process. After completing the above steps, launch Google Chrome again to see if it works properly now. 5. Delete Chrome User Profile If you are still having problems, it may be time to delete Chrome User Profile. This will delete all your personal information, so be sure to back up all relevant data. Typically, you delete the Chrome user profile through the browser itself. But given that you can't open it, here's another way: Turn on Windo

When Windows cannot detect a second monitor, first check whether the physical connection is normal, including power supply, cable plug-in and interface compatibility, and try to replace the cable or adapter; secondly, update or reinstall the graphics card driver through the Device Manager, and roll back the driver version if necessary; then manually click "Detection" in the display settings to identify the monitor to confirm whether it is correctly identified by the system; finally check whether the monitor input source is switched to the corresponding interface, and confirm whether the graphics card output port connected to the cable is correct. Following the above steps to check in turn, most dual-screen recognition problems can usually be solved.

Mini PCs have undergone

Have problems uploading files in Google Chrome? This may be annoying, right? Whether you are attaching documents to emails, sharing images on social media, or submitting important files for work or school, a smooth file upload process is crucial. So, it can be frustrating if your file uploads continue to fail in Chrome on Windows PC. If you're not ready to give up your favorite browser, here are some tips for fixes that can't upload files on Windows Google Chrome 1. Start with Universal Repair Before we learn about any advanced troubleshooting tips, it's best to try some of the basic solutions mentioned below. Troubleshooting Internet connection issues: Internet connection

When encountering the problem of printing task stuck, clearing the print queue and restarting the PrintSpooler service is an effective solution. First, open the "Device and Printer" interface to find the corresponding printer, right-click the task and select "Cancel" to clear a single task, or click "Cancel all documents" to clear the queue at one time; if the queue is inaccessible, press Win R to enter services.msc to open the service list, find "PrintSpooler" and stop it before starting the service. If necessary, you can manually delete the residual files under the C:\Windows\System32\spool\PRINTERS path to completely solve the problem.
