Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

route (command)

From Wikipedia, the free encyclopedia
Computer operating system command
For other uses of "route", seeRoute (disambiguation).
route
TheReactOSroute command
DevelopersFred N. van Kempen,Microsoft,IBM, ReactOS Contributors
Operating systemUnix-like,OS/2,Microsoft Windows,ReactOS
PlatformCross-platform
TypeCommand
LicenseOS/2, Windows:Proprietarycommercial software
ReactOS:GPLv2

Incomputing,route is acommand used to view and manipulate theIProuting table inUnix-like andMicrosoftWindows[1]operating systems and also inIBMOS/2 andReactOS.[2] Manual manipulation of the routing table is characteristic ofstatic routing.

Implementations

[edit]

Unix and Unix-like

[edit]

Theroute command originated in 4.2BSD. It is not part of any UNIX standard, but the BSD interface is widely implemented.[3]

Linux contains a version of theroute originally written by Fred N. van Kempen, later merged withnetstat's codebase (another command originating in 4.2BSD). It implements an extended syntax compared to the BSD version. InLinux distributions based on 2.2.xLinux kernels, theifconfig androute commands are operated together to connect a computer to a network, and to define routes betweencomputer networks. Distributions based on later kernels have deprecatedifconfig androute, replacing them withiproute2.[4]

OnmacOS, theroute utility is present but largely nonfunctional. Displaying the routing table is instead performed vianetstat -nr.

Syntax

[edit]

The BSD syntax is:

route[-dnqtv]{add|del|flush|get|monitor}[[modifiers]args]

The Linux syntax is:

route[-nNvee][-FC][<AF>]# List kernel routing tablesroute[-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.

In other words, the basicroute add androute del commands are portable.

Example

[edit]
user@linux:~$route-nKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface192.168.101.0   192.168.102.102 255.255.255.0   UG    0      0        0 eth0192.168.102.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0192.168.103.0   192.168.102.102 255.255.255.0   UG    0      0        0 eth0192.168.12.0    0.0.0.0         255.255.255.0   U     0      0        0 eth00.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 theTCP/IP protocol is installed as a component in the properties of anetwork 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 theWindows Registry and is used to initialize the IP routing table whenever the TCP/IP protocol is started (only when used with theadd command)
  • Command: The command to run (add,change,delete,print)
  • -4: Force usingIPv4
  • -6: Force usingIPv6
  • 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 onWindows NT 4.0,Windows 2000,Windows Millennium Edition, andWindows XP. It is not supported onWindows 95 orWindows 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]

ReactOS is an open-source Windows clone. Theroute 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":[2]

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]

Further reading

[edit]

References

[edit]
  1. ^"Adding a TCP/IP Route to the Windows Routing Table". Archived fromthe original on 2016-11-13. Retrieved2016-11-13.
  2. ^ab"Reactos/Reactos".GitHub. 4 November 2021.
  3. ^route(8) – FreeBSD System Manager'sManual
  4. ^route(8) – Linux Programmer'sManual – Administration and Privileged Commands from Manned.org

External links

[edit]
Wikibooks has a book on the topic of:Guide to Windows Commands
Ecosystem
Interpreters
Terminals
File system navigation
File management
Archiving
Disk management
Processes
Registry
User environment
File contents
Scripting
Networking
Maintenance and care
Boot management
Software development
Miscellaneous
Retrieved from "https://en.wikipedia.org/w/index.php?title=Route_(command)&oldid=1321196275"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp