Route (command)

Last updated
route
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.

Contents

Implementations

Unix and Unix-like

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

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

user@linux:~$ route-n Kernel 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

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:

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:

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: <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

Syntax

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

Further reading

Related Research Articles

An Internet Protocol address is a numerical label such as 192.0.2.1 that is assigned to a device connected to a computer network that uses the Internet Protocol for communication. IP addresses serve two main functions: network interface identification, and location addressing.

Internetwork Packet Exchange (IPX) is the network-layer protocol in the IPX/SPX protocol suite. IPX is derived from Xerox Network Systems' IDP. It also has the ability to act as a transport layer protocol.

In computing, traceroute and tracert are diagnostic command-line interface commands for displaying possible routes (paths) and transit delays of packets across an Internet Protocol (IP) network.

<span class="mw-page-title-main">Routing table</span> Data table stored in a router that lists the routes to network destinations

In computer networking, a routing table, or routing information base (RIB), is a data table stored in a router or a network host that lists the routes to particular network destinations, and in some cases, metrics (distances) associated with those routes. The routing table contains information about the topology of the network immediately around it.

<span class="mw-page-title-main">Network address translation</span> Technique for making connections between IP address spaces

Network address translation (NAT) is a method of mapping an IP address space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device. The technique was originally used to bypass the need to assign a new address to every host when a network was moved, or when the upstream Internet service provider was replaced, but could not route the network's address space. It has become a popular and essential tool in conserving global address space in the face of IPv4 address exhaustion. One Internet-routable IP address of a NAT gateway can be used for an entire private network.

<span class="mw-page-title-main">Subnet</span> Logical subdivision of an IP network

A subnetwork, or subnet, is a logical subdivision of an IP network. The practice of dividing a network into two or more networks is called subnetting.

Network utilities are software utilities designed to analyze and configure various aspects of computer networks. The majority of them originated on Unix systems, but several later ports to other operating systems exist.

ipconfig Console application program

ipconfig is a console application program of some computer operating systems that displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. IPCONFIG

<span class="mw-page-title-main">Supernetwork</span> Aggregation of Internet Protocol networks

A supernetwork, or supernet, is an Internet Protocol (IP) network that is formed by aggregation of multiple networks into a larger network. The new routing prefix for the aggregate network represents the constituent networks in a single routing table entry. The process of forming a supernet is called supernetting, prefix aggregation, route aggregation, or route summarization.

netstat Command line network statistics tool

In computing, netstat is a command-line network utility that displays open network sockets, routing tables, and a number of network interface and network protocol statistics. It is available on Unix, Plan 9, Inferno, and Unix-like operating systems including macOS, Linux, Solaris and BSD. It is also available on IBM OS/2 and on Microsoft Windows NT-based operating systems including Windows XP, Windows Vista, Windows 7, Windows 8 and Windows 10.

Netfilter is a framework provided by the Linux kernel that allows various networking-related operations to be implemented in the form of customized handlers. Netfilter offers various functions and operations for packet filtering, network address translation, and port translation, which provide the functionality required for directing packets through a network and prohibiting packets from reaching sensitive locations within a network.

ifconfig Network administration utility

ifconfig is a system administration utility in Unix-like operating systems for network interface configuration.

IP aliasing is associating more than one IP address to a network interface. With this, one node on a network can have multiple connections to a network, each serving a different purpose.

<span class="mw-page-title-main">Linux Virtual Server</span> Load-balancing software

Linux Virtual Server (LVS) is load balancing software for Linux kernel–based operating systems.

A default gateway is the node in a computer network using the Internet protocol suite that serves as the forwarding host (router) to other networks when no other route specification matches the destination IP address of a packet.

Static routing is a form of routing that occurs when a router uses a manually-configured routing entry, rather than information from dynamic routing traffic. In many cases, static routes are manually configured by a network administrator by adding in entries into a routing table, though this may not always be the case. Unlike dynamic routing, static routes are fixed and do not change if the network is changed or reconfigured. Static routing and dynamic routing are not mutually exclusive. Both dynamic routing and static routing are usually used on a router to maximise routing efficiency and to provide backups in case dynamic routing information fails to be exchanged. Static routing can also be used in stub networks, or to provide a gateway of last resort.

Sockstress is a method of attacking servers and other devices that accept TCP connections on the Internet and other TCP-based networks. This method depletes local resources in order to crash a service or an entire machine, essentially functioning as a denial-of-service attack.

IP routing is the application of routing methodologies to IP networks. This involves not only protocols and technologies but includes the policies of the worldwide organization and configuration of Internet infrastructure. In each IP network node, IP routing involves the determination of a suitable path for a network packet from a source to its destination in an IP network. The process uses static configuration rules or dynamically obtained from routing protocols to select specific packet forwarding methods to direct traffic to the next available intermediate network node one hop closer to the desired final destination, a total path potentially spanning multiple computer networks.

tc (Linux) Linux user-space utility program

tc is the user-space system administration utility program used to configure the Linux kernel packet scheduler. Tc is usually packaged as part of the iproute2 package.

netsniff-ng Linux networking toolkit

netsniff-ng is a free Linux network analyzer and networking toolkit originally written by Daniel Borkmann. Its gain of performance is reached by zero-copy mechanisms for network packets, so that the Linux kernel does not need to copy packets from kernel space to user space via system calls such as recvmsg . libpcap, starting with release 1.0.0, also supports the zero-copy mechanism on Linux for capturing (RX_RING), so programs using libpcap also use that mechanism on Linux.

References