Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    keep

    Syntax

    keep (all | none);

    Hierarchy Level

    [edit logical-systems logical-system-name protocols bgp],[edit logical-systems logical-system-name protocols bgp group group-name],[edit logical-systems logical-system-name protocols bgp group group-name neighbor address],[edit logical-systems logical-system-name routing-instances routing-instance-name protocols bgp],[edit logical-systems logical-system-name routing-instances routing-instance-name protocols bgp group group-name],[edit logical-systems logical-system-name routing-instances routing-instance-name protocols bgp group group-name neighbor address],[edit protocols bgp],[edit protocols bgp group group-name],[edit protocols bgp group group-name neighbor address],[edit routing-instances routing-instance-name protocols bgp],[edit routing-instances routing-instance-name protocols bgp group group-name],[edit routing-instances routing-instance-name protocols bgp group group-name neighbor address]

    Release Information

    Statement introduced before Junos OS Release 7.4.

    Statement introduced in Junos OS Release 9.0 for EX Series switches.

    Statement introduced in Junos OS Release 11.3 for the QFX Series.

    Statement introduced in Junos OS Release 14.1X53-D20 for the OCX Series.

    Description

    Control whether or not Junos OS keeps in memory and hides certain routes.

    If the keep none statement is used, Junos OS does not retain in memory and hide routes that are rejected because of a BGP import policy. Nor does BGP keep in memory and hide routes that are declared unfeasible due to BGP sanity checks. The keep none statement causes Junos OS to discard from memory the routes that are rejected due to BGP-specific logic or BGP evaluation. When a route is rejected because of some non-BGP-specific reason, the keep none statement has no effect on this route. This rejected route is retained in memory and hidden even though keep none is configured. An example of this type of hidden route is a route for which the protocol nexthop is unresolved.

    The routing table can retain the route information learned from BGP in one of the following ways:

    • Default (omit the keep statement)—Keep all route information that was learned from BGP, except for routes whose AS path is looped and whose loop includes the local AS.
    • keep all—Keep all route information that was learned from BGP.
    • keep none—Discard routes that were received from a peer and that were rejected by import policy or other sanity checking, such as AS path or next hop. When you configure keep none for the BGP session and the inbound policy changes, Junos OS forces readvertisement of the full set of routes advertised by the peer.

    In an AS path healing situation, routes with looped paths theoretically could become usable during a soft reconfiguration when the AS path loop limit is changed. However, there is a significant memory usage difference between the default and keep all.

    Consider the following scenarios:

    • A peer readvertises routes back to the peer from which it learned them.

      This can happen in the following cases:

      • Another vendor's routing device advertises the routes back to the sending peer.
      • The Junos OS peer’s default behavior of not readvertising routes back to the sending peer is overridden by configuring advertise-peer-as.
    • A provider edge (PE) routing device discards any VPN route that does not have any of the expected route targets.

    When keep all is configured, the behavior of discarding routes received in the above scenarios is overridden.

    Caution: If you add or remove keep all or keep none and the peer does not support session restart, the associated BGP sessions are restarted (flapped). To determine if a peer supports refresh, check for Peer supports Refresh capability in the output of the show bgp neighbor command.

    Default

    By default, BGP retains incoming rejected routes in memory and hides them. If you do not include the keep statement, most routes are retained in the routing table. BGP keeps all route information that was learned from BGP, except for routes whose AS path is looped and whose loop includes the local AS.

    Options

    all—Retain all routes.

    none—Discard routes that were received from a peer and that were rejected by import policy or other sanity checking. When keep none is configured for the BGP session and the inbound policy changes, Junos OS forces readvertisement of the full set of routes advertised by the peer.

    Required Privilege Level

    routing—To view this statement in the configuration.

    routing-control—To add this statement to the configuration.

    Modified: 2017-03-03