The following example configures the originate default route feature for BGP (Border Gateway Protocol) neighbor 2001:db8:1::2 using policy def_originate.pol.
def_originate.pol entry prefix_matching { if match any { nlri 2001:db8:2::/48; } then { as-path "65001"; permit; } } enable bgp neighbor 2001:db8:1::2 address-family ipv6-unicast originate-default policy def_originate
With this configuration, a default route is originated and sent to neighbor 2001:db8:1::2 only if there is a BGP route in the local RIB which matches the statement nlri 2001:db8:2::/48. If a matching route exists, the default route is sent to neighbor 2001:db8:1::2 with the 65001 as-path prepended. If this is an EBGP neighbor, then the local AS-Number is prepended after 65001.
If the route for the match statement 2001:db8:2::/48 goes away and there is no other matching route in the BGP RIB, the default route origination feature becomes inactive and BGP withdraws the default route ::/0 from neighbor 2001:db8:1::2. When a matching route becomes available again in the local BGP RIB, the default route origination feature becomes active again and the default route ::/0 is advertised to neighbor 2001:db8:1::2.