home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


TCP/IP Network Administration

TCP/IP Network AdministrationSearch this book
Previous: B.8 Protocol Statements Appendix B
A gated Reference
Next: B.10 Control Statements
 

B.9 static Statements

static statements define the static routes used by gated . A single static statement can specify several routes. The static statements occur after protocol statements and before control statements in the gated.conf file. To gated , static routes are any routes defined with static statements. However, unlike the routes in a static routing table, these routes can be overridden by routes with better preference values.

The structure of a static statement is:

static {
[ default ] | [[ host ] address [ mask mask | masklen n ]] gateway gateways
[ interface interface_list ]
[ preference preference ]
[ retain ]
[ reject ]
[ blackhole ]
[ noinstall ] ;
address [ mask mask | masklen n ] interface interface
[ preference preference ]
[ retain ]
[ reject ]
[ blackhole ]
[ noinstall ] ;
} ;

The static statement has two different clauses. The one with the keyword gateway is the one you'll use. This clause contains information similar to that provided by the route command. A static route is defined as a destination address reached though a gateway. The format of this clause is:

[ default ] | [[ host ] address [ mask mask | masklen number ]] gateway gateways

Defines a static route through one or more gateways. The destination is defined by the keyword default (for the default route) or by a destination address. The destination address can be preceded by the keyword host , if it is a host address, or followed by an address mask. The address mask can be defined with the keyword mask and a dotted decimal address mask, or by the keyword masklen and a numeric prefix length. The listed gateways must be on a directly attached network. Possible configuration parameters are:

interface interface_list

When specified, gateways in the gateway_list must be directly reachable through one of these interfaces.

preference preference

Sets the gated preference for this static route. The default is 60.

retain

Prevents this static route from being removed during a graceful shutdown. Normally only interface routes are retained in the kernel forwarding table. Use this to provide some routing when gated is not running.

reject

Installs this route as a "reject route." Packets sent to a reject route are dropped and an "unreachable" message is sent back to the source. Not all kernels support reject routes.

blackhole

Installs this route as a "blackhole route." A blackhole route is the same as a reject route except the "unreachable" message is not sent.

noinstall

Instructs system to advertise this route via routing protocols but not to install it in the kernel forwarding table.

The other static statement clause uses the keyword interface instead of the keyword gateway . Use this clause only if you have a single physical network with more than one network address - a rare occurrence. ifconfig normally creates only one destination for each interface. This special form of the static statement adds additional destinations to the interface.

address [ mask mask | masklen number ] interface interface

The preference, retain, reject, blackhole, and noinstall options are the same as described above.

The default preference of a static route is 60, which prefers static routes over several other routing sources. If you want other types of routes to override static routes, use the preference argument on the static statement to increase the preference number. (Remember that high preference values mean less-preferred routes.)

The following example defines a static default route through the gateway 172.16.12.1. The preference is set to 125 so that routes learned from RIP are preferred over this static route:

static  {
	default gateway 128.66.12.1 preference 125 ;
 } ;