route command is another network troubleshooting tool used available in Windows, Linux, Unix-like systems, IBM OS, and ReactOS. It is used to display and make changes to routing tables. The command comes with many parameters, with which you can clear the routing table, set network destination, set the command to use IPv4 or Ipv6, and more.
Key functionalities:
route print
: Displays the current routing table, showing active routes, interface information, and metrics.route add
: Adds a new static route to the routing table.route delete
: Removes an existing static route from the routing table.route change
: Modifies an existing static route.
How to use the
route
command:- Open a Command Prompt or PowerShell as administrator .
- Type the
route
command followed by the desired action and parameters . For example:route print
(to view the routing table)route add <destination> MASK <netmask> <gateway> METRIC <metric>
(to add a static route)route delete <destination> MASK <netmask> <gateway>
(to delete a static route)
- Press Enter to execute the command .
Example:
To add a static route to reach the network
192.168.1.0/24
through the gateway 192.168.1.1
with a metric of 1:Important notes:
- The
route
command requires administrator privileges. - You can use the
-p
option with theadd
command to make a route persistent, meaning it will be preserved after a system restart. - The
route
command can be used with different parameters to fine-tune its behavior, such as specifying the interface or using the-f
option to clear the routing table before adding or modifying routes.