You are on page 1of 5

route Command Purpose Manually manipulates the routing tables.

Syntax route [ -f ] [ -n ] [ -q ] [ -v ] Command [ Family ] [ [ -net | -host ] D estination [ -prefixlen n] [ -netmask [ Address ] ] Gateway ] [ Arguments ] Description The route command allows you to make manual entries into the network rout ing tables. The route command distinguishes between routes to hosts and routes to networks by interpreting the network address of th e Destination variable, which can be specified either by symbolic name or numeric address. The route command resolves all symbolic names into addresses, using either the /etc/hosts file or the network name server. Routes to a particular host are distinguished from those to a network by interpreting the Internet address associated with the destination. The optional keywords -net and -host force the destination t o be interpreted as a network or a host, respectively. If the destination has a local address part of INADDR_ANY or if the destinat ion is the symbolic name of a network, then the route is assumed to be to a network; otherwise, it is presumed to be a route to a host. For example, 128.32 is interpreted as -host; 128.32.130 is int erpreted as -host; -net 128.32 is interpreted as; and -net 128.32.130 is interpreted as If the route is by way of an interface rather than through a gateway, the -interface argument should be specified. The specified gateway is the address of the host on the common network, indicating the interface to be used for transmission. The -netmask argument must be followed by an address parameter (to be int erpreted as a network mask). One can override the implicit network mask generated in the -inet case by making sure this option follo ws the Destination parameter. All symbolic names specified for a destination or gateway are looked up f irst as a host name, using the gethostbyname subroutine. If this fails, the getnetbyname subroutine is then used to interpret the nam e as a network name. Note: Route uses a routing socket and the new message types RTM_ADD, RTM_DELETE, and RTM_CHANGE. As such, only the root user may modify the routing tables. If the flush or -f command is specified, route will "flush," or clear, th e routing tables of all gateway entries. One can choose to flush only those routes whose destinations are of a given address family, by specifying an optional keyword describing which address family.

Parameters Arguments Specifies one or more of the following arguments. -net Indicates that the Destination parameter should be interpreted as a network. Make sure thi s option follows the Destination parameter. The host portion of the address is 0 (zero). when reporting results of a flush or of any action in verbose mode. -rttvar n Specifies round-trip time variance. rather than symbolicall y. -q Specifies quiet mode and suppresses all output.The netstat -r command displays the current routing information contained in the routing tables. -allowgroup gid . -sendpipe n Specifies send-window size. -interface Manipulates interface routing entries. Where n is specifi ed as a variable to an argument. which is used for the generation of cloned routes. the value of the n variable is a positive integer. -v Specifies verbose mode and prints additional details. Flags -f Purges all entries in the routing table that are not associated with network interfaces. -active_dgd Enables Active Dead Gateway Detection on the route. -n Displays host and network names numerically. -recvpipe n Specifies receive-window size. -rtt n Specifies round-trip time. -genmask Extracts the length of TSEL. -cloning Clones a new route. but the network portion of the address is specified. -host Indicates that the Destination parameter should be interpreted as a host. The route default is a host (a single computer on the network). the route is assumed to be to a network. -netmask Specifies the network mask to the destination address. -prefixlen n Specifies the length of a destination prefix (the number of bits in the netmask). When neit her the -net parameter nor the -host parameter is specified.

-if ifname Specifies the interface (en0. . -expire n Specifies expiration metrics used by routing protocol -ssthresh n Specifies outbound gateway buffer limit. -weight n Specifies the weight of the route that will be used for the W eighted policies with the Multipath Routing feature. -hopcount n Specifies maximum number of gateways in the route. -stopsearch Stops searching if a routing table lookup matches the route.Specifies a group ID that is allowed to use the route. Will over ride interface mtu for TCP applications as long as it does not exceed maximum mtu for the interface. On the other hand . -denygroup gid Specifies a group ID that is not allowed to use the route. -iface Specifies that the destination is directly reachable. Th e group ID will be added to a list of denied groups or deleted from a list of allowed groups. then the global no command option called mpr_policy determines the policy that will be used. n is n umber between 1 and 5 where these numbers mean the following: 1 Weighted Round-Robin 2 Random 3 Weighted Random 4 Lowest Utilization 5 Hash-based If the policy is not explicitly set and multipath routing is used.. -mtu n Specifies maximum transmission unit for this route. -policy n Specifies the policy to be used for Multipath Routing. The -lock meta-modifier must precede each modifier to be locked. see the no command.) to associate with this route so that packets will be sent using this interface when this route is chosen. if the policy is explicitly set to WRR then this setting overrides the mpr_policy setting. This flag has no af fect on mtu for applications using UDP. tr0 . The default policy i s Weighted Round Robin which behaves just like Round-Robin when the weights are all 1. -lock Specifies a meta-modifier that can individually lock a metric modifier. For more information about these policies. -xresolve Emits a message on use (for external lookup). then the network option mpr_policy takes precedence. -lockrest Specifies a meta-modifier that can lock all subsequent metric s.. Although the Default policy is We ighted Round-Robin. but it is not allowed to use the route due to group routing restrictions. when the policy is not set. The gr oup ID will be added to a list of allowed groups or deleted from a list of denied groups.

The 192. type: route add -net 192. flush or -f Removes all routes.201. get Lookup and display the route for a destination.13. -nostatic Specifies the pretend route that is added by the kernel or da emon.100. The 192.-static Specifies the manually added route. -proto1 Sets protocol specific routing flag number 1. The Gateway p arameter can be specified either by symbolic name or numeric address.13. Command Specifies one of six possibilities: add Adds a route.100. type: route add 192.7 The 192. routing lockup misses.13.100.100. Family Specifies the address family. change Changes aspects of a route (such as its gateway).7 The 192.201.100. -proto2 Sets protocol specific routing flag number 2.100. delete Deletes a specific route.0 address is that of the receiving network (the Dest ination parameter). Gateway Identifies the gateway to which packets are addressed.7 address is that of the routing computer (the Gateway parameter). 2 To establish a route so you can send a message to any user on a spec ific network. set Set the policy and weight attributes of a route.0 192.100. -reject Emits an ICMP unreachable when matched.7 address is that of the . The -inet address family is the defaul t.201. or suspected network partitionings. monitor Reports any changes to the routing information base.7 address is that of the receiving computer (the Des tination parameter).100. Destination Identifies the host or network to which you are directing the route. The -inet6 family specifies that all subsequent addresses are in the inet6 family.7 192. -blackhole Silently discards packets during updates.201. The Destination parameter can be specified either by symbolic name or numeric address.13. Examples 1 To establish a route so that a computer on one network can send a me ssage to a computer on a different network.

158. type: route add 0 The 192.7 address is that of the gateway chosen to be the default. route -f To add a route specifying weight and policy information.2. The gethostbyname subroutine. getnetbyname subroutine.100.2 192.100. type .7 The value 0 or the default keyword for the Destination parameter mea ns that any packets sent to destinations not previously defined and not on a directly connected network go through the defau lt gateway. The /etc/hosts file format.13.3 System Management Guide: Communications and Networks.3 routing network (the Gateway parameter). TCP/IP Addressing in AIX 5L Version 5.2 192. type: 5 6 : route set 192. type: route add 192. Gateways. 4 To clear the host gateway table.2.2. The routed daemon.5 -weight 5 -policy 4 To set the weight and policy attributes of a preexisting route. To establish a default gateway. TCP/IP Routing.5 -weight 3 -policy Related Information The netstat command.158.