You are currently viewing Route Command 9 Powerful Examples You Must Know (Linux & Windows)

Route Command 9 Powerful Examples You Must Know (Linux & Windows)

  • Post author:
  • Post last modified:June 22, 2025

The route command is a core networking tool used to view and manipulate the routing table in both Linux and Windows. It plays a crucial role in network routing, allowing administrators to configure static routes, troubleshoot connectivity issues, and direct network traffic efficiently.

In this guide, we’ll explore 9 powerful examples and use cases of the route command across Linux and Windows, answer frequently asked questions like “What is the command to see IP routes?” and compare ip route vs. route tools in Linux.

What Is the Route Command Used For?

The route command is used to view, add, and delete routes from a device’s routing table. It helps control how packets travel from your machine to other networks.

Which utility displays the routing table?

On Linux, commands like route -n and ip route show the routing table. On Windows, you can use route print, which is the answer to “Which of the following utilities would you use to view the routing table?”.

1. How to View Routing Table: Linux vs Windows

OSCommandDescription
Linuxip routeDisplays current IP routing table
Linuxroute -nLegacy tool showing numeric routes
Windowsroute printDisplays all current Windows IP routes

2. Add Static Route in Linux

Adding a static route helps you define a specific path for IP traffic. To add a route in Linux with ip:

sudo ip route add 192.168.1.0/24 via 10.0.0.1

This directs traffic for 192.168.1.0/24 through the gateway 10.0.0.1.

3. Route Add Command in Windows

To define a permanent static route in Windows, use the following:

route add 192.168.20.0 mask 255.255.255.0 10.0.0.1 -p

The -p flag makes the route persistent across reboots.

4. Route Delete in Linux

Need to remove a route? Here’s how to delete it in Linux:

sudo ip route delete 192.168.1.0/24

Alternatively, the legacy way:

sudo route del -net 192.168.1.0 netmask 255.255.255.0

5. Windows Route Delete

To remove a persistent route in Windows, use:

route delete 192.168.20.0

6. What Does ip route 0.0.0.0/0 Do?

ip route 0.0.0.0/0 via X.X.X.X sets the default gateway. It directs all traffic not matching a more specific route.

7. Difference Between IP and Route Commands in Linux

Some users ask: What is the difference between ip and route command?

  • ip is part of the modern iproute2 tools — newer, more versatile.
  • route is older and considered deprecated but still widely used.

Prefer ip for new scripts or automation!

8. How to Route Using CMD in Windows

Want to know how to route using CMD in Windows? Simple:

  • route print – shows routing table
  • route add, route delete – add/remove routes

Make sure to run CMD as Administrator!

9. Making Routes Persistent

Linux makes routes persistent via network config files like /etc/network/interfaces or NetworkManager.

Windows allows persistent routes with the -p flag in route add.

FAQ: Route Command & Routing Tables

What is the command to see IP route?

Use ip route in Linux and route print in Windows to view current IP routes.

How to add static route in Linux?

Use sudo ip route add DESTINATION via GATEWAY. For example: sudo ip route add 10.10.0.0/16 via 192.168.1.1.

Is “ip r” the same as “ip route” in Linux?

Yes, ip r is a shorthand alias for ip route and displays the same routing information.

How do I find Windows device’s routing table?

The route print command shows the routing table on a Windows device.

Can I delete a route permanently in Windows?

Yes. Just use route delete DESTINATION. To prevent auto-add, ensure no persistent route is added for it elsewhere.

Closing Thoughts: Why the Route Command Still Matters

Despite advancements in auto-routing and network discovery, the route command remains a critical tool in both Linux routing and Windows route configuration. Mastering its usage allows for precise control over network behavior, optimal traffic handling, and efficient troubleshooting.

Ready to take control of your routing tables? Test out a few of these commands in your dev environment and see how your packets flow!