The peer default-route-advertise command configures a BGP device to advertise a default route to its peer or peer group.
The undo peer default-route-advertise command restores the default setting.
By default, a BGP device does not advertise default routes to its peer or peer group.
peer { group-name | ipv4-address | ipv6-address } default-route-advertise [ route-policy route-policy-name ] [ conditional-route-match-all { ipv4-address1 { mask1 | mask-length1 } } &<1-4> | conditional-route-match-any { ipv4-address2 { mask2 | mask-length2 } } &<1-4> ]
peer { group-name | ipv4-address | ipv6-address } default-route-advertise [ route-policy route-policy-name ] [ conditional-route-match-all { ipv6-address1 prefix-length1 } &<1-4> | conditional-route-match-any { ipv6-address2 prefix-length2 } &<1-4> ]
undo peer { group-name | ipv4-address | ipv6-address } default-route-advertise
Parameter | Description | Value |
---|---|---|
group-name | Specifies the name of a peer group. | The name is a string of 1 to 47 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
ipv4-address | Specifies the IPv4 address of a peer. | The value is in dotted decimal notation. |
prefix-length1 | Specifies the IPv6 prefix range using the mask length. | The value is an integer that ranges from 0 to 128. If ::0 less-equal 128 is used, all IPv6 addresses will be matched. |
prefix-length2 | Specifies the IPv6 prefix range using the mask length. | The value is an integer that ranges from 0 to 128. If ::0 less-equal 128 is used, all IPv6 addresses will be matched. |
ipv6-address | Specifies the IPv6 address of a peer. | The value is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
route-policy route-policy-name | Specifies the name of a route-policy. | The name is a string of 1 to 40 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string. |
conditional-route-match-all | Configures the BGP device to send default routes to a peer or peer group when the routing table contains all conditional routes. | - |
ipv4-address1 | Specifies the IPv4 address of conditional routes. | The value is in dotted decimal notation. |
ipv6-address1 | Specifies the IPv6 address of conditional routes. | The value is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
mask1 | Specifies the mask of conditional routes. | The value is in dotted decimal notation. |
mask-length1 | Specifies the mask length of conditional routes. | The value is an integer that ranges from 0 to 32. |
conditional-route-match-any | Configures the BGP device to send default routes to a peer or peer group when the routing table contains any conditional route. | - |
ipv4-address2 | Specifies the IPv4 address of conditional routes. | The value is in dotted decimal notation. |
ipv6-address2 | Specifies the IPv6 address of conditional routes. | The value is a 32-digit hexadecimal number, in the format of X:X:X:X:X:X:X:X. |
mask2 | Specifies the mask of conditional routes. | The value is in dotted decimal notation. |
mask-length2 | Specifies the mask length of conditional routes. | The value is an integer that ranges from 0 to 32. |
ipv4-address is only valid in the BGP view, BGP-IPv4 unicast address family view, BGP-IPv6 unicast address family view, BGP-IPv4 multicast address family view, and BGP-VPN instance IPv4 address family view.
ipv6-address is only valid in the BGP-IPv6 unicast address family view and BGP-VPN instance IPv6 address family view.
conditional-route-match-all and conditional-route-match-any are valid only in the BGP view, BGP-IPv4 unicast address family view, BGP-VPN instance IPv6 address family view, BGP-IPv6 unicast address family view, and BGP-VPN instance IPv4 address family view.
BGP view, BGP-IPv4 unicast address family view, BGP-IPv4 multicast address family view, BGP-VPN instance IPv4 address family view, BGP-IPv6 unicast address family view, BGP-VPN instance IPv6 address family view
Usage Scenario
Default routes are commonly used on a network that meets the following conditions:
Each device has multiple EBGP peers and receives all routes on the network from each EBGP peer.
There are multiple route reflectors (RRs), and each RR receives all routes on the network.
If load balancing is not implemented on the network, a BGP peer receives at most one copy of active routes on the network. If load balancing is implemented on the network, the number of active routes received by a BGP peer will be increased by multiple times, causing the number of routes on the network to sharply increase. To greatly reduce the number of routes on such a network, configure a BGP device to advertise only default routes to its BGP peer and use default routes for traffic load balancing.
Prerequisites
BGP peer relationships have been established using the peer as-number command.
Precautions
After this command is run, a BGP device sends a default route with the next hop as itself to its peer or peer group regardless of whether default routes exist in the routing table.
Creating a route-policy before it is referenced is recommended. By default, nonexistent route-policies cannot be referenced using the command. If the route-policy nonexistent-config-check disable command is run in the system view and a nonexistent route-policy is referenced using the current command, the attributes of the default route to be advertised to the specified peer or peer group are not changed.