Configure Redistribution to BGP

Configure a redistribution entry to announce routes of a certain source protocol type into the BGP domain such as: DvR routes, static routes, Routing Information Protocol (RIP) routes, or direct routes. Use a route policy to control the redistribution of routes.

Note

Note

When a route map with attributes set to origin and local-pref is applied to the BGP redistribute command, the attributes are not applied to the redistributed routes.

Before you begin

  • If required, a route policy exists.

  • You can configure BGP on a VRF instance the same way you configure the GlobalRouter, except that you must use VRF Router Configuration mode and the prefix ip bgp. The VRF must have an RP Trigger of BGP.

    Note

    Note

    Route refresh is not currently supported on non-default VRFs.

  • Before you redistribute DvR host routes to BGP, you must disable BGP aggregation and BGP auto-summarization of networks, using the commands no ip bgp aggregation enable and no ip bgp auto-summary respectively.

    Disabling these settings ensures that all the DvR host routes are correctly advertised into BGP and are not summarized.

Note

Note

When applying a route map to an inter-vrf redistribution, the route map and any associated IP prefix lists must be configured first on the source VRF before configuring the redistribute policy on the destination VRF.

Inter-vrf redistribution is not supported on IPv6 routes.

Procedure

  1. Enter BGP Router Configuration mode:

    enable

    configure terminal

    router bgp

  2. Create a redistribution instance:

    redistribute <direct|dvr|ipv6-direct|ipv6-isis|ipv6-static|isis|ospf|ospfv3|rip|ripng|static>

    Note

    Note

    Redistribution of ripng routes into BGP is supported only on VRF 0.

  3. If required, specify a route policy to govern redistribution:

    redistribute <direct|dvr|ipv6-direct|ipv6-isis|ipv6-static|isis|ospf|ospfv3|rip|ripng|static> route-map WORD<0-64> [vrf-src WORD<1-16>]

  4. If required, configure the route metric:

    redistribute <direct|dvr|ipv6-direct|ipv6-isis|ipv6-static|isis|ospf|ospfv3|rip|ripng|static> metric <0-65535> [vrf-src WORD<1-16>]

  5. If required, configure the route metric-type:

    redistribute <direct|dvr|ipv6-direct|ipv6-isis|ipv6-static|isis|ospf|ospfv3|rip|ripng|static> metric—type live-metric [vrf-src WORD<1-16>

  6. Enable the instance:

    redistribute <direct|dvr|ipv6-direct|ipv6-isis|ipv6-static|isis|ospf|ospfv3|rip|ripng|static> enable [vrf-src WORD<1-16>]

  7. Exit BGP Router Configuration mode:

    exit

  8. Apply the redistribution instance configuration:

    For IPv4: ip bgp apply redistribute <direct|dvr|isis|ospf|rip|static> [vrf WORD<1–16>] [vrf-src <WORD 1-16>]

    For IPv6: ipv6 bgp apply redistribute <direct|dvr|isis|ospf|rip|static> [vrf <WORD 1-16>]

  9. Apply BGP redistribution to a specific VRF:

    ip bgp apply redistribute vrf WORD<1-16>

    Changes do not take effect until you apply them.

  10. View all routes (including DvR host routes) that are redistributed into BGP:

    View routes redistributed from GRT to BGP:

    For IPv4: show ip bgp imported-routes

    For IPv6: show bgp ipv6 imported-routes

    View routes redistributed to BGP for a specific VRF instance:

    For IPv4: show ip bgp imported-routes [vrf WORD<1–64>] [vrfids WORD<0–512>]

    For IPv6: show bgp ipv6 imported-routes [WORD<1-256>] [vrf WORD<1–16>] [vrfids WORD<0-255>]

Examples

Redistribute direct routes from the VRF instance source1 into BGP, in the GRT context.

Create a redistribution instance:

Switch:1>enable
Switch:1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch:1(config)#router bgp
Switch(router-bgp)#redistribute direct vrf-src source1

If required, specify a route policy to govern redistribution:

Switch(router-bgp)# redistribute direct route-map policy1 vrf-src source1

If required, configure the route metric:

Switch:1(router-bgp)# redistribute direct metric 4 vrf-src source1

Enable the instance:

Switch:1(router-bgp)# redistribute direct enable vrf-src source1

Exit BGP Router Configuration mode:

Switch:1(router-bgp)# exit

Apply the redistribution instance configuration:

Switch:1(config)# ip bgp apply redistribute direct vrf-src source1

Redistribute DvR routes from the GRT to BGP:

Switch:1>enable
Switch:1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch:1(config)#router bgpSwitch:1(router-bgp)#redistribute dvr
Switch:1(router-bgp)#redistribute dvr enable
Switch:1(router-bgp)#exit
Switch:1(config)#ip bgp apply redistribute dvr 

View the host routes (including DvR host routes) that are redistributed from the GRT to BGP:

Switch:1(config)#show ip bgp imported-routes vrf vrf1

=================================================================================
                       BGP Imported Routes - VRF vrf1
=================================================================================
ROUTE                          METRIC COMMUNITY LOCALPREF NEXTHOP         ORIGIN
---------------------------------------------------------------------------------
192.0.2.1/255.255.255.0         0      0         100      198.51.100.1    INC   
192.0.2.2/255.255.255.0         0      0         100      198.51.100.1    INC   
192.0.2.3/255.255.255.0         0      0         100      198.51.100.1    INC   
...
...
...
3 out of 763 Total Num of imported routes displayed

Redistribute DvR routes to BGP for the specific VRF instance vrf1:

Switch:1>enable
Switch:1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch:1(config)#router vrf vrf1
Switch:1(router-vrf)#ip bgp redistribute dvr
Switch:1(router-vrf)#ip bgp redistribute dvr enable
Switch:1(router-vrf)#exit
Switch:1(config)#ip bgp apply redistribute dvr vrf vrf1

View the DvR host routes that are redistributed to BGP for vrf vrf1:

Switch:1(config)#show ip bgp imported-routes vrf vrf1

=================================================================================
                         BGP Imported Routes - VRF vrf1
=================================================================================
ROUTE                          METRIC COMMUNITY LOCALPREF NEXTHOP         ORIGIN
---------------------------------------------------------------------------------
192.0.2.4/255.255.255.0       0      0         100       203.0.113.1        INC
192.0.2.5/255.255.255.0       0      0         100       203.0.113.1        INC
192.0.2.6/255.255.255.0       0      0         100       203.0.113.1        INC
192.0.2.7/255.255.255.0       0      0         100       203.0.113.1        INC
192.0.2.8/255.255.255.0       0      0         100       203.0.113.1        INC
...
...
...
5 out of 675 Total Num of imported routes displayed

This example demonstrates redistribution of inter-VRF routes (both direct and DvR routes) to BGP, with a route policy configured.

Redistribute inter-VRF DvR routes between VRFs (with VRF IDs 10 and 30), to BGP.

Switch:1>enable
Switch:1#configure terminal
Switch:1(config)#router vrf 10
Switch:1(router-vrf)#ip prefix-list "test10" 192.0.2.0/24  ge 25 le 32
Switch:1(router-vrf)#route-map "test10" 1
Switch:1(router-vrf)#permit
Switch:1(router-vrf)#enable
Switch:1(router-vrf)#match network "test10"
Switch:1(router-vrf)#set metric 99
Switch:1(router-vrf)#exit


Switch:1(config)#router vrf 30
Switch:1(router-vrf)#ip bgp redistribute direct vrf-src 10
Switch:1(router-vrf)#ip bgp redistribute direct enable vrf-src 10
Switch:1(router-vrf)#ip bgp redistribute dvr vrf-src 10
Switch:1(router-vrf)#ip bgp redistribute dvr route-map "test10" vrf-src 10
Switch:1(router-vrf)#ip bgp redistribute dvr enable vrf-src 10
Switch:1(router-vrf)#exit


Switch:1(config)#ip bgp apply redistribute direct vrf 30 vrf-src 10
Switch:1(config)#ip bgp apply redistribute dvr vrf 30 vrf-src 10

Variable Definitions

The following table defines parameters for the redistribute and ip bgp apply redistribute commands.

Variable

Value

<direct | dvr | ipv6-direct | ipv6-isis | ipv6-static | isis | ospf | ospfv3 | rip | ripng| static >

Specifies the type of routes to redistribute (the protocol source).

enable

Enables the BGP route redistribution instance.

metric <0-65535>

Configures the metric to apply to redistributed routes.

metric-type live-metric

Configures the metric type to apply to redistributed routes.

When you enable the live-metric option, when BGP redistributes static, RIP, OSPF, IS-IS, or DvR routes, the metric value is taken from the routing table and is set to the Path attributes as a MED value.

By default, this option is disabled, which means the BGP MED value is not derived from the metric in the routing table.

route-map WORD<0-64>

Configures the route policy to apply to redistributed routes.

vrf WORD<1–16>

Specifies the name of a VRF instance.

vrf-src WORD<1-16>

Specifies the source VRF instance by name for route redistribution.