route [subcommand] [args]
This command is used to display and manipulate the routing table.
When invoked with no arguments, the current routing information is
displayed. When invoked with the subcommands add
or del
,
then additional arguments must be provided to describe the route.
Command templates include the following:
route [add|del] -net IP_ADDRESS gw GATEWAY_ADDRESS [netmask MASK] route [add|del] -host IP_ADDRESS gw GATEWAY_ADDRES [netmask MASK]
When not provided the netmask defaults to 255.255.255.0
This command returns 0 on success and non-zero if an error is encountered.
Just like its counterpart on GNU/Linux and BSD systems, this command is complicated. More example usages would be a welcome submission.
The following is an example of how to use route
to display,
add, and delete a new route:
[/] $ route Destination Gateway/Mask/Hw Flags Refs Use Expire Interface default 192.168.1.14 UGS 0 0 0 eth1 192.168.1.0 255.255.255.0 U 0 0 1 eth1 192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1444 eth1 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 10844 1202 eth1 192.168.1.151 00:1C:23:B2:0F:BB UHL 2 37 1399 eth1 [/] $ route add -net 192.168.3.0 gw 192.168.1.14 [/] $ route Destination Gateway/Mask/Hw Flags Refs Use Expire Interface default 192.168.1.14 UGS 0 0 0 eth1 192.168.1.0 255.255.255.0 U 0 0 1 eth1 192.168.1.14 00:A0:C8:1C:EE:28 UHL 2 0 1498 eth1 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 14937 1202 eth1 192.168.1.151 00:1C:23:B2:0F:BB UHL 2 96 1399 eth1 192.168.3.0 192.168.1.14 UGS 0 0 0 eth1 [/] $ route del -net 192.168.3.0 gw 192.168.1.14 [/] $ route Destination Gateway/Mask/Hw Flags Refs Use Expire Interface default 192.168.1.14 UGS 0 0 0 eth1 192.168.1.0 255.255.255.0 U 0 0 1 eth1 192.168.1.14 00:A0:C8:1C:EE:28 UHL 1 0 1498 eth1 192.168.1.51 00:1D:7E:0C:D0:7C UHL 0 15945 1202 eth1 192.168.1.151 00:1C:23:B2:0F:BB UHL 2 117 1399 eth1
This command is included in the default shell command set.
When building a custom command set, define
CONFIGURE_SHELL_COMMAND_ROUTE
to have this
command included.
This command can be excluded from the shell command set by
defining CONFIGURE_SHELL_NO_COMMAND_ROUTE
when all
shell commands have been configured.
The route
is implemented by a C language function
which has the following prototype:
int rtems_shell_rtems_main_route( int argc, char **argv );
The configuration structure for the route
has the
following prototype:
extern rtems_shell_cmd_t rtems_shell_ROUTE_Command;
Copyright © 1988-2008 OAR Corporation