Topic: tech juniper jir prev next

tech juniper jir > 02: Protocol Independent Routing

02: Protocol Independent Routing

Static Routes

An administrator manually configures a route. Static routes are configured under the edit routing-options configuration hierarchy.

Static routes have a default preference of 5.

Destination prefix and next-hop must be specified for a static route. The next-hop is the next IP address, or reject or discard (the former sends an ICMP, the latter does not).

On point to point interfaces, the egress interface can be specified instead of a next-hop.

By default, the next-hop IP address of static routes must be reachable using a direct route (a directly connected network) for the route to be active. If a next-hop IP address becomes unreachable, the route will not become active. By default, Junos does not perform recursive lookups for the next-hop IP address. The resolve option on a route changes this to enable recursive lookups.

qualified-next-hop allows next hops to be specified with different preferences. For example, two next hops can be specified with different preferences; if the first becomes unavailable, the second will be used. This is also called a ‘floating static route’. Example;

static {
    route 0.0.0.0/0 {
        next-hop ...;
        qualified-next-hop ... {
            preference 7;
        }
    }
}

The no-readvertise option stops static routes being advertised through routing policy. It is highly recommended that routes for management traffic have this option set.

The defaults section specifies defaults for static routes that do not have options defined. Example;

static {
    defaults {
        preference 250;
    }
}

Other route options include as-path, community, metric and preference. The first two are useful if the route is to be redistributed into BGP. metric breaks ties between routes with the same preference value.

Aggregate Routes

Collections of routes with similar destinations and the same next-hop. Reduce the size of routing advertisements and the routing table or ‘RIB’, and hide local routing instabilities.

Aggregate routes must have at least one contributing route active in the routing table to be active. The default route preference for aggregate routes is 130. If the router receives a packet for a more specific route inside the aggregate route, but the more specific route does not exist or is inactive, the router sends an ICMP ‘reject’.

The edit routing-options hierarchy has a defaults section, like static routes. There can only be one aggregate route per prefix; in other words, a prefix can only be part of one aggregated route.

The additional options for aggregate routes are the same as for static routes, except there is an additional policy option. By default, the router activates an aggregate route with just one contributing route. The policy option requires more contributing routes to be active.

show route <prefix> exact detail shows the contributing routes for an aggregate route.

Generated Routes

Similar to aggregate routes. Generated routes are active when at least one contributing (more specific) route is active. A generated route receives the next-hop of the primary contributing route. The route with the lowest preference, then the lowest number prefix (not the lowest prefix length), is selected as the primary contributing route.

Example; generated routes can be used to advertise a default route, only when a specific route is received from another router.

Match a prefix advertised over BGP to this router, naming the rule to do so as match-contributing-prefix;

policy-options {
    policy-statement match-contributing-prefix {
        from {
            protocol bgp;
            route-filter 10.0.0.0/16 exact;
        }
        then accept;
    }
    term else-reject {
        then reject;
    }

Add a second policy to match the default generated route, to later export it to OSPF. Note that aggregate here matches both aggregate and generated routes;

    policy-statement export-default {
        term match-default {
            from {
                protocol aggregate;
                route-filter 0.0.0.0/0 exact;
            }
            then accept;
        }
    }
}

Generate the default route if match-contributing-prefix was matched;

routing-options {
    generate {
        defaults {
            preference 130;
        }
        route 0.0.0.0/0 policy match-contributing-prefix;
    }
}

Finally, export the default route into OSPF, which will only work if the route is generated above;

protocols ospf {
    export export-default;
    area 0.0.0.0 {
        ....
    }
}

Manage Martian Routes

Addresses for which all routing information is ignored. These routes are normally sent by improperly configured systems.

routing-options {
    show martians {
        .... orlonger;
    }
}

Use the allow command to remove prefixes from the martians address list.