All routing protocols store the routes that they learn in the routing table. The routing table uses this collected route information to determine the active routes to destinations. The routing table then installs the active routes into its forwarding table and also exports them back into the routing protocols. It is these exported routes that the protocols advertise.

For each protocol, you control which routes the protocol stores in the routing table and which routes the routing table exports into the protocol by defining a routing policy for that protocol. For information about defining a routing policy, see the JUNOS Policy Framework Configuration Guide.

By default, if a router has multiple OSPF areas, learned routes from other areas are automatically installed into area 0 of the routing table.

To apply routing policies that affect how the routing table exports routes into OSPF, include the export statement:

export [ policy-names ];
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement.

OSPF import policy allows users to define policy to prevent adding OSPF routes to the routing table. This filtering happens when OSPF installs the route in the routing table. You can filter the routes, but not LSA flooding. The import policy can filter on any attribute of the OSPF route.

To filter OSPF routes from being added to the routing table, include the import statement:

import [ policy-names ];
For a list of hierarchy levels at which you can include this statement, see the statement summary section for this statement

 

    以下为常用策略“route-filter 192.168/16” 后面跟的参数匹配情况

exact      route-filter 192.168/16 exact 解释:单单匹配192.168/16 单条路由

longer     route-filter 192.168/16 longer 解释:只匹配192.168/16 后面掩码的路由条目

orlonger  route-filter 192.168/16 orlonger 解释:不仅匹配192.168/16 而且包括后面掩码的路由条目

upto        route-filter 192.168/16 upto /24 解释: 仅匹配起始掩码到结束掩码的路由条目

through   route-filter 192.168/16 upto 192.168.16/20 解释:匹配192.168/16开始到另外一个地址192.168.16/20的掩码范围

prefix length range   route-filter 192.168/16 prefix length range /18-/20 解释:匹配网络地址192.168.0.0  18为掩码到20位掩码之间的路由条目

policy