6.4.1 Route Filtering

Routes are filtered by specifying configuration language that will match a certain set of routes by destination, or by destination and mask. Among other places, route filters are used on martians, and in import and export statements.

The action taken when no match is found is dependent on the context. For instance import and export route filters assume an all reject ; at the end of a list.

A route will match the most specific filter that applies. Specifying more than one filter with the same destination, mask and modifiers will generate an error.












Filtering syntax

    network [ exact | refines | between number and number ]
    network mask mask [ exact | refines | between number and number ]
    network masklen number [ exact | refines | between number and
number ]
    all
    default
    host host





These are all the possible formats for a route filter. Not all of these formats are available in all places. For instance the host and default formats are not valid for martians.

In most cases it is possible to specify additional parameters relevant to the context of the filter. For example, on a martian statement it is possible to specify the allow keyword, on an import statement you can specify a preference, and on a export you can specify a metric.

network [ exact | refines | between number and number ]
network mask mask [ exact | refines| between number and number ]
network masklen number [ exact | refines| between number and number ]
Matching usually requires both an address and a mask, although the mask is implied in the shorthand forms listed below. These three forms vary in how the mask is specified. In the first form, the mask is implied to be the natural mask of the network. In the second, the mask is explicitly specified. In the third, the mask is specified by the number of contiguous one bits.

If no additional parameters are specified, any destination that falls in the range given by the network and mask is matched, so the mask of the destination is ignored. If a natural network is specified, the network, any subnets, and any hosts will be matched. The three optional modifiers cause the mask of the destination to also be considered:

exact
This parameter specifies that the mask of the destination must match the supplied mask exactly. This is used to match a network, but no subnets or hosts of that network.
refines
Specifies that the mask of the destination must be more specified (i.e. longer) than the filter mask. This is used to match subnets and/or hosts of a network, but not the network.
between number and number
Specifies that the mask of the destination must be as or more specific (i.e., as long as or longer) than the lower limit (the first numberparameter) and no more specific (i.e., as long as or shorter) than the upper limit (the second numberparameter). Note that exact and refines are both special cases of between.


all
This entry matches anything. It is equivalent to:
     0.0.0.0 mask 0.0.0.0
     



  



default

Matches the default route. To match, the address must be the default address and the mask must be all zeros. This is equivalent to:
     0.0.0.0 mask 0.0.0.0 exact
     



  



host host

Matches the specific host. To match, the address must exactly match the specified hostand the network mask must be a host mask (i.e. all ones). This is equivalent to:
     host mask 255.255.255 exact
     






Last updated April 26, 1997

gated@gated.merit.edu