Route (command)

Computer operating system command
title: "Route (command)" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["internet-protocol-based-network-software", "os/2-commands", "routing", "unix-network-related-software", "windows-communication-and-services", "windows-administration"] description: "Computer operating system command" topic_path: "technology/networking" source: "https://en.wikipedia.org/wiki/Route_(command)" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::summary Computer operating system command ::
::data[format=table title="Infobox software"]
| Field | Value |
|---|---|
| name | route |
| screenshot | ReactOS-0.4.13 route command 667x514.png |
| caption | The ReactOS route command |
| developer | Fred N. van Kempen, Microsoft, IBM, ReactOS Contributors |
| operating system | Unix-like, OS/2, Microsoft Windows, ReactOS |
| platform | Cross-platform |
| genre | Command |
| license | OS/2, Windows: Proprietary commercial software |
| ReactOS: GPLv2 | |
| :: |
| name = route
| logo =
| screenshot = ReactOS-0.4.13 route command 667x514.png
| screenshot size =
| caption = The ReactOS route command
| developer = Fred N. van Kempen, Microsoft, IBM, ReactOS Contributors
| released =
| latest release version =
| latest release date =
| operating system = Unix-like, OS/2, Microsoft Windows, ReactOS
| platform = Cross-platform
| genre = Command
| license = OS/2, Windows: Proprietary commercial software
ReactOS: GPLv2
| website =
In computing, **route** is a command used to view and manipulate the IP routing table in Unix-like and Microsoft Windows operating systems and also in IBM OS/2 and ReactOS. Manual manipulation of the routing table is characteristic of static routing.
Implementations
Unix and Unix-like
The command originated in 4.2BSD. It is not part of any UNIX standard, but the BSD interface is widely implemented.
Linux contains a version of the originally written by Fred N. van Kempen, later merged with [netstat](netstat)'s codebase (another command originating in 4.2BSD). It implements an extended syntax compared to the BSD version. In Linux distributions based on 2.2.x Linux kernels, the [ifconfig](ifconfig) and route commands are operated together to connect a computer to a network, and to define routes between computer networks. Distributions based on later kernels have deprecated ifconfig and route, replacing them with [iproute2](iproute2).
On macOS, the route utility is present but largely nonfunctional. Displaying the routing table is instead performed via netstat -nr.
Syntax
The BSD syntax is: ::code[lang=shell] route [-dnqtv] {add|del|flush|get|monitor} [[modifiers] args] ::
The Linux syntax is: ::code[lang=shell] route [-nNvee] [-FC] [] # List kernel routing tables route [-v] [-FC] {add|del|flush} ... # Modify routing table for AF. route {-h|--help} [] # Detailed usage syntax for specified AF. route {-V|--version} # Display version/author and exit. ::
In other words, the basic route add and route del commands are portable.
Example
::code[lang=console] user@linux:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.101.0 192.168.102.102 255.255.255.0 UG 0 0 0 eth0 192.168.102.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.103.0 192.168.102.102 255.255.255.0 UG 0 0 0 eth0 192.168.12.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.12.1 0.0.0.0 UG 0 0 0 eth0 ::
Microsoft Windows
The command is only available if the TCP/IP protocol is installed as a component in the properties of a network adapter.
Syntax
The command-syntax is: ::code[lang=dos] route [-f] [-p] [-4|-6] [Command [Destination] [mask Netmask] [Gateway] [[metric Metric]] [[if Interface]] ::
Parameters
- -f: Clears the routing table
- -p: The route is added to the Windows Registry and is used to initialize the IP routing table whenever the TCP/IP protocol is started (only when used with the add command)
- Command: The command to run (add, change, delete, print)
- -4: Force using IPv4
- -6: Force using IPv6
- Destination: Network destination of the route
- mask Netmask: The netmask (subnet mask) associated with the network destination
- Gateway: The forwarding or next hop IP address over which the set of addresses defined by the network destination and subnet mask are reachable
- metric Metric: Integer cost metric (ranging from 1 to 9999) for the route
- if Interface: The index of the interface over which the destination is reachable
- /?: Command help
The -p parameter is only supported on Windows NT 4.0, Windows 2000, Windows Millennium Edition, and Windows XP. It is not supported on Windows 95 or Windows 98.
IBM OS/2
Syntax
The command-syntax is: ::code[lang=dos] route [-nqv] [COMMAND] [[MODIFIERS] args] ::
Parameters
- -n: Bypasses translating IP addresses to symbolic host names
- -q: Suppresses all output
- -v: Verbose
- COMMAND: The command to run (add, delete, change, get, monitor, flush)
- -net: is a network address
- -host: is host name or address (default)
- -netmask: the mask of the route
- ****: IP address or host name of the destination
- ****: IP address or host name of the next-hop router
ReactOS
ReactOS is an open-source Windows clone. The implementation will eventually cover all options supported by Windows, but the current (as of 2025) version does not. It instead implements a subset of the options, a "poor man's route":
Syntax
Print the route table: ::code[lang=dos] route print ::
Add a route: ::code[lang=dos] route add [mask
Delete a route: ::code[lang=dos] route delete ::
References
References
- "Adding a TCP/IP Route to the Windows Routing Table".
- (4 November 2021). "Reactos/Reactos".
- {{Man. 8. route. FreeBSD
- {{man. 8. route. Linux
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::