Tải bản đầy đủ
[Appendix B] B.9 static Statements

[Appendix B] B.9 static Statements

Tải bản đầy đủ

[Appendix B] B.9 static Statements

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:
file:///C|/mynapster/Downloads/warez/tcpip/appb_09.htm (2 of 3) [2001-10-15 09:19:18]

[Appendix B] B.9 static Statements

static

{
default gateway 128.66.12.1 preference 125 ;

} ;

Previous: B.8 Protocol
Statements
B.8 Protocol Statements

TCP/IP Network
Administration
Book Index

Next: B.10 Control
Statements
B.10 Control Statements

[ Library Home | DNS & BIND | TCP/IP | sendmail | sendmail Reference | Firewalls | Practical Security ]

file:///C|/mynapster/Downloads/warez/tcpip/appb_09.htm (3 of 3) [2001-10-15 09:19:18]

[Appendix B] B.10 Control Statements

Previous: B.9 static
Statements

Appendix B
A gated Reference

Next: B.11 The Aggregate
Statements

B.10 Control Statements
The control statements define your routing policy. Often when administrators hear the terms "routing
policy" or "policy-based routing," they assume that this is something done inside the routing protocol.
In reality, a routing policy is defined outside of the routing protocol in the configuration file. The
policy defines what routes are accepted and what routes are advertsied. gated does this with two
control statements: import and export. The import statement defines which routes are accepted and
from what sources those routes are accepted. The export statement defines which routes are
advertised based on the source of the routes and the protocol used to advertise them.
The import and export statements use gated preference, routing metrics, routing filters, and AS paths
to define routing policy. Preference and metrics are controlled by these keywords:
restrict
Says that the routes are not to be imported, in the case of the import command, or exported in
the case of the export command. This keyword blocks the use of a specific route.
preference preference
Defines the preference value used when comparing this route to other routes. Preference is
used when installing routes; not when advertising routes.
metric metric
Specifies the metric used when advertising a route.
Route filters match routes by destination address. Among other places, route filters are used on
martians and import and export statements. A route matches the most specific filter that applies.
Specifying more than one filter with the same destination, mask, and modifiers generates an error.
Import and export route filters can be specified in the following ways: [2]
[2] Route filters may include additional parameters. On import statements they include
a preference, and on export statements a metric. "Preference" and "metric" are
described previously.

file:///C|/mynapster/Downloads/warez/tcpip/appb_10.htm (1 of 8) [2001-10-15 09:19:19]

[Appendix B] B.10 Control Statements

address [mask mask | masklen number] [exact | refines]
Defines a range of addresses using an address and an address mask. The address mask can be
defined with the keyword mask and a mask written in dotted decimal notation or with the
keyword masklen and a numeric prefix length. If no mask is defined the natural mask of the
network is used. Two options can be used:
exact
Matches a network, but no subnets or hosts of that network.
refines
Matches subnets and/or hosts of a network, but not the network itself.
all
Matches every possible address.
default
Matches only the default route.
host address
Matches an individual host address.
A routing filter that matches everything on network number 192.168.12.0 and the individual host
10.104.19.12 contains:
192.168.12.0 masklen 24 ;
host 10.104.19.12 ;
When no route filtering is specified in an import or export statement, all routes from the specfied
source will match that statement. If any filters are specified, only routes that match the specified filters
are imported or exported.
Border Gateway Protocol (BGP) is designed to support policy-based routing. A key feature of BGP is
that it is a path-vector protocol. Import and export statements allow you to use the AS path vector to
enforce your routing policy.
An AS path lists the autonomous systems end-to-end for a route, and provides an indication of the
completeness of the path. Each autonomous system that a route passes through prepends its AS
number to the beginning of the AS path.
The "origin" of the path indicates its completeness. An origin of igp indicates the route was learned
from an interior routing protocol and is most likely complete. An origin of egp indicates the route was
file:///C|/mynapster/Downloads/warez/tcpip/appb_10.htm (2 of 8) [2001-10-15 09:19:19]