Route (command)

Computer operating system command

For other uses of "route", see Route (disambiguation).

route

The ReactOS `route` command

Developer(s)| Fred N. van Kempen, Microsoft, IBM, ReactOS Contributors
Operating system| Unix-like, OS/2, Microsoft Windows, ReactOS
Platform| Cross-platform
Type| Command
License| OS/2, Windows: Proprietary commercial software
ReactOS: GPLv2

In computing, `route` is a command used to view and manipulate the IP routing table in Unix-like and Microsoft Windows[1] operating systems and also in IBM OS/2 and ReactOS.[2] Manual manipulation of the routing table is characteristic of static routing.

## Implementations

[edit]

### Unix and Unix-like

[edit]

In Linux distributions based on 2.2.x Linux kernels, the `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`. Route for Linux was originally written by Fred N. van Kempen.[3]

#### Syntax

[edit]

The command-syntax is:

route [-nNvee] [-FC] [<AF>]           # List kernel routing tables
route [-v] [-FC] {add|del|flush} ...  # Modify routing table for AF.
route {-h|--help} [<AF>]              # Detailed usage syntax for specified AF.
route {-V|--version}                  # Display version/author and exit.

#### Example

[edit]

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

[edit]

The command is only available if the TCP/IP protocol is installed as a component in the properties of a network adapter.

#### Syntax

[edit]

The command-syntax is:

route [-f] [-p] [-4|-6] [Command [Destination] [mask Netmask] [Gateway] [[metric Metric]] [[if Interface]]

#### Parameters

[edit]

* `-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

[edit]

#### Syntax

[edit]

The command-syntax is:

route [-nqv] [COMMAND] [[MODIFIERS] args]

#### Parameters

[edit]

* `-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`: `<dest>` is a network address
* `-host`: `<dest>` is host name or address (default)
* `-netmask`: the mask of the route
* `<dest>`: IP address or host name of the destination
* `<gateway>`: IP address or host name of the next-hop router

### ReactOS

[edit]

#### Syntax

[edit]

Print the route table:

route print

Add a route:

route add <target> [mask <mask>] <gw> [metric <m>]

Delete a route:

route delete <target> <gw>

## See also

[edit]

* Routing table
* Internet Protocol Suite
* iproute2
* BusyBox

## Further reading

[edit]

* Stanek, William R. (2004). Microsoft Windows Command-Line Administrator's Pocket Consultant. ISBN 0-735-62038-5.
* John Paul Mueller (2007). Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000. John Wiley & Sons. ISBN 978-0470165799.

## References

[edit]

1. ^ Adding a TCP/IP Route to the Windows Routing Table
2. ^ "Reactos/Reactos". GitHub. 4 November 2021.
3. ^ "Route(8): Show/Change IP routing table - Linux man page".

## External links

[edit]

Wikibooks has a book on the topic of: Guide to Windows Commands

* `route(8)` – 4.2BSD System Manager's Manual
* `route(8)` – Linux Administration and Privileged Commands Manual
* `route(8)` – FreeBSD System Manager's Manual
* `route(8)` – Solaris 11.4 System Administration Commands Reference Manual
* route \- on technet.microsoft.com

* v
* t
* e

Windows command-line programs and shell builtins

Ecosystem|

| Interpreters|

* COMMAND.COM
* Command Prompt
* PowerShell
* Recovery Console

|

Terminals|

* Windows Console
* Windows Terminal

File system navigation|

* cd (chdir)
* dir
* popd
* pushd
* tree

File management|

* attrib
* cacls
* cipher
* compact
* copy
* del (erase)
* deltree
* icacls
* mkdir (md)
* mklink
* move
* openfiles
* recover
* ren (rename)
* replace
* rmdir (rd)
* robocopy
* takeown
* xcopy

Archiving|

* expand
* extrac32
* extract
* makecab
* pax
* tar

Disk management|

* chkdsk
* convert
* defrag
* diskcomp
* diskcopy
* diskpart
* diskraid
* diskshadow
* drvspace
* fdisk
* format
* fsutil
* label
* manage-bde
* MSCDEX
* refsutil
* subst
* scandisk
* sys
* vol
* vssadmin

Processes|

* at
* exit
* kill
* runas
* sc
* schtasks
* shutdown
* start
* taskkill
* tasklist

Registry|

* assoc
* ftype
* reg
* regini
* regsvr32

User environment|

* chcp
* cmdkey
* date
* graftabl
* mode
* path
* set
* setver
* setx
* time
* title
* ver
* where
* whoami

File contents|

* comp
* edit
* edlin
* fc
* find
* findstr
* print
* type

Scripting|

* choice
* clip
* cscript
* doskey
* echo
* for
* forfiles
* goto
* if
* more
* pause
* prompt
* rem
* timeout

Networking|

* arp
* bitsadmin
* curl
* getmac
* hostname
* ipconfig
* nbtstat
* net
* netsh
* netstat
* nslookup
* PathPing
* ping
* rpcping
* route
* scp
* setspn
* sftp
* ssh
* ssh-add
* ssh-agent
* ssh-keygen
* ssh-keyscan
* tracert
* winrm
* winrs

Maintenance and care|

* auditpol
* dism
* dispdiag
* driverquery
* eventcreate
* eventtriggers
* gpresult
* gpupdate
* logman
* mofcomp
* msiexec
* ntbackup
* pentnt
* pnpunattend
* pnputil
* REAgentC
* relog
* sfc
* sxstrace
* systeminfo
* tpmtool
* tpmvscmgr
* tracerpt
* typeperf
* w32tm
* WBAdmin
* wecutil
* wevtutil
* winmgmt
* winsat
* wmic

Boot management|

* bcdedit
* bootcfg
* bootsect
* fixboot
* fixmbr

Software development|

* break
* debug
* exe2bin
* QBasic
* wsl

Miscellaneous|

* cls
* dpath
* help

* List of DOS commands
* Environment variables
* Windows Support Tools

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template