In the chapter pertaining to path control, we learned about route redistribution as it applies to the various IGPs that are within the scope of the ROUTE exam. This section focuses on redistribution between BGP and EIGRP or OSPF.
Redistributing EIGRP Routes into BGP
EIGRP-learned routes are redistributed into BGP by using the redistribute eigrp [AS] [metric <MED>] [route-map <name>] router configuration command. The [metric <MED>] keyword specifies the MED that will be assigned to the prefixes when they are redistributed into BGP. If this keyword is omitted, the IGP metric will be used instead. The [route-map <name>keyword is used to specify a route map that will be used for policy control. For example, the referenced route map may be used to set attributes such as the BGP LOCAL_PREF or WEIGHT for the redistributed prefixes. The following output shows the routing table entry for the 192.168.1.0/24 prefix which is learned by R1 via EIGRP:
| R1#show ip route 192.168.1.0 255.255.255.0 Routing entry for 192.168.1.0/24 Known via “eigrp 1”, distance 90, metric 2297856, type internal Redistributing via eigrp 1 Last update from 10.0.9.2 on Serial0/0, 00:00:14 ago Routing Descriptor Blocks: * 10.0.9.2, from 10.0.9.2, 00:00:14 ago, via Serial0/0 Route metric is 2297856, traffic share count is 1 Total delay is 25000 microseconds, minimum bandwidth is 1544 Kbit Reliability 255/255, minimum MTU 1500 bytes Loading 1/255, Hops 1 |
To redistribute this, and only this prefix into BGP on R1, the following must be performed:
| R1(config)#ip prefix-list NET-192-ONLY seq 5 permit 192.168.1.0/24 R1(config)#route-map EIGRP-INTO-BGP permit 10 R1(config-route-map)#match ip address prefix-list NET-192-ONLY R1(config-route-map)#exit R1(config)#route-map EIGRP-INTO-BGP deny 20 R1(config-route-map)#exit R1(config)#router bgp 123 R1(config-router)#redistribute eigrp 1 route-map EIGRP-INTO-BGP R1(config-router)#exit R1(config)#exit R1#clear ip bgp * soft out |
In the output above, notice that although a route map was used for policy control, ensuring that only the 192.168.1.0/24 prefix was redistributed into BGP, no metric was set. By default, the prefix will therefore be assigned a metric that is equal to the IGP metric. In addition to this, when routes are redistributed into BGP from an IGP, the NEXT_HOP is set to the next hop IP address of the IGP. In this example, the NEXT_HOP attribute for this prefix will be 10.0.9.2. Additionally, the ORIGIN will be set to INCOMPLETE; however, all other attributes, e.g. LOCAL_PREF and WEIGHT, will use default BGP values. These default parameters can be validated using theshow ip bgp command as follows:
| R1#show ip bgp 192.168.1.0/24 BGP routing table entry for 192.168.1.0/24, version 227 Paths: (1 available, best #1, table Default-IP-Routing-Table) Advertised to update-groups: 1 2 Local 10.0.9.2 from 0.0.0.0 (1.1.1.1) Origin incomplete, metric 2297856, localpref 100, weight 32768, valid, sourced, best |
NOTE: If the NEXT_HOP address is not known to other iBGP peers, the prefix will be marked as inaccessible. To resolve this, the subnet running EIGRP must be advertised into the interior network or the local BGP speaker must be configured with the neighbor [address] next-hop-self route configuration command for all internal peers.
Redistributing OSPF Routes into BGP
While the redistribution of EIGRP routes into BGP is a straightforward process; redistributing OSPF routes into BGP entails a little more thought. By default, when OSPF routes are redistributed into BGP, only internal OSPF and external Type 1 routes will be redistributed. To further clarify this point, router R1 is receiving the following routes via OSPF:
| R1#show ip route ospf O 192.168.1.0/24 [110/2] via 10.0.9.2, 00:02:08, Serial0/0 O E2 192.168.2.0/24 [110/20] via 10.0.9.2, 00:00:17, Serial0/0 |
OSPF is then redistributed into BGP using the redistribute ospf [process] router configuration command on R1 as illustrated in the following output:
| R1(config)#router bgp 123 R1(config-router)#redistribute ospf 1 R1(config-router)#exit R1(config)#exit R1#clear ip bgp * soft out |
Following this configuration, the BGP RIB on R1 shows that only the internal OSPF route, i.e. the 192.168.1.0/24 prefix has been redistributed:
| R1#show ip bgp regexp ^$ BGP table version is 240, local router ID is 1.1.1.1 Status codes: s suppressed, d damped, h history, * valid, > best, i – internal, r RIB-failure, S Stale Origin codes: i – IGP, e – EGP, ? – incompleteNetwork Next Hop Metric LocPrf Weight Path *> 192.168.1.0 10.0.9.2 2 32768 ? |
Because the default OSPF external route type is a Type 2 external route, the redistribution of these prefixes into BGP can be facilitated by performing one of two actions:
- By changing the default OSPF external route type to a Type 1 external route
- Using the redistribute ospf [process] match [type] command
The first action was described in detail in OSPF redistribution earlier in this guide. To avoid being repetitive, and for brevity, this will not be described again in this chapter. Refer to the chapter on path control if you are unable to recall how to configure Type 1 external routes during redistribution into OSPF. The second option is the preferred option as it negates the need to change your OSPF redistribution configuration, assuming you used the default parameters which results in a Type 2 external route for all redistributed routes. When OSPF routes are redistributed into BGP, the router can be configured to match the following:
- Internal
- NSSA External 1
- NSSA External 2
- External 1
- External 2
The match internal configuration command configures BGP to redistribute routes that are local to the autonomous system, i.e. internal OSPF routes. By default, these routes are redistributed. The match external 1configuration command configures BGP to redistribute external Type 1 OSPF routes. By default, these routes are redistributed. The match external 2 configuration command configured BGP to redistribute external Type 2 OSPF routes. While Cisco IOS software defaults to Type 2 external routes when external routing information is injected into OSPF on the ASBR, these routes are not redistributed into BGP by default and the router must be manually configured to redistribute these prefixes.
The match nssa-external 1 configuration command configures BGP to redistribute NSSA external Type 1 OSPF routes. By default, these routes are redistributed. The match nssa-external 2 configuration command configures BGP to redistribute NSSA external Type 2 OSPF routes. By default, these routes are also not redistributed.
Continuing with the example used in the previous section that showed the internal and external OSPF routes being received on R1, BGP is now configured to redistribute Type 2 external routes in addition to the internal route received. This is performed as follows:
| R1(config)#router bgp 123 R1(config-router)#redistribute ospf 1 match internal external 2 R1(config-router)#exit R1(config)#exit R1#clear ip bgp * soft out |
Following this configuration, both prefixes are now present in the BGP RIB on R1. The internal prefix, 192.168.1.0/24 has the same MED as the OSPF route. The second prefix, which was redistributed into OSPF using default parameters, has the default OSPF metric of 20 assigned to it. The NEXT_HOP for both prefixes is the IGP next hop. All other attributes use the default values. These values can all be validated using the show ip bgpcommand as shown below:
| R1#show ip bgp regexp ^$ BGP table version is 241, local router ID is 1.1.1.1 Status codes: s suppressed, d damped, h history, * valid, > best, i – internal, r RIB-failure, S Stale Origin codes: i – IGP, e – EGP, ? – incompleteNetwork Next Hop Metric LocPrf Weight Path *> 192.168.1.0 10.0.9.2 2 32768 ? *> 192.168.2.0 10.0.9.2 20 32768 ? |
Redistributing BGP Routes into IGPs
NOTE: While this section illustrates how to redistribute BGP routes into IGPs, it is important to remember that this is never recommended, unless absolutely necessary. In situations where you must redistribute BGP into any IGP, it is highly recommended that you use route maps during redistribution to ensure that you redistribute only those prefixes that you want. NEVER redistribute BGP into any IGP without using route maps or any other IOS filtering mechanisms.
When redistributing BGP routes into IGPs, by default iBGP routes will not be redistributed into the IGP. Instead, only eBGP routes will be redistributed. The primary reason for this default behavior is to avoid routing loops within the interior network. In most cases, iBGP routes are already known by the IGP that is running in the interior network. It therefore goes without saying that these routes should not be redistributed back into the IGP; hence the default Cisco IOS software behavior. The redistribution of BGP routes into an IGP follows the same basic logic used when redistributing any other routes into the particular Interior Gateway Protocol.
When redistributing BGP routes into EIGRP, the metric must be specified during redistribution, by issuing theredistribute bgp [AS] metric router configuration command. Alternatively, the default (seed) metric for the redistributed routes can also be specified using the default-metric router configuration command in EIGRP configuration mode. The following configuration illustrates how to redistribute the default route from BGP into EIGRP:
| R3(config)#ip prefix-list DEFAULT-ONLY description ‘Only The Default Route’ R3(config)#ip prefix-list DEFAULT-ONLY seq 5 permit 0.0.0.0/0 R3(config)#route-map BGP-INTO-EIGRP permit 10 R3(config-route-map)#description ‘Redistribute Only The Default Route’ R3(config-route-map)#match ip address prefix-list DEFAULT-ONLY R3(config-route-map)#exit R3(config)#route-map BGP-INTO-EIGRP deny 20 R3(config-route-map)#description ‘Explicitly Deny All Other Routes’ R3(config-route-map)#exit R3(config)#router eigrp 1 R3(config-router)#default-metric 10000 100 255 1 1500 R3(config-router)#redistribute bgp 123 route-map BGP-INTO-EIGRP R3(config-router)#exit |
Following this configuration, used the show ip route command to verify that the default route is known via BGP and is being redistributed into EIGRP using the specified route map. The output of this command shows the following for the default route:
| R3#show ip route 0.0.0.0 0.0.0.0 Routing entry for 0.0.0.0/0, supernet Known via “bgp 123”, distance 20, metric 0, candidate default path Tag 1, type external Redistributing via eigrp 1 Advertised by eigrp 1 route-map BGP-INTO-EIGRP Last update from 10.0.3.2 00:06:12 ago Routing Descriptor Blocks: * 10.0.3.2, from 10.0.3.2, 00:06:12 ago Route metric is 0, traffic share count is 1 AS Hops 1 |
The same can also be confirmed by viewing the EIGRP Topology Table as shown below:
| R3#show ip eigrp topology 0.0.0.0 0.0.0.0 IP-EIGRP (AS 1): Topology entry for 0.0.0.0/0 State is Passive, Query origin flag is 1, 1 Successor(s), FD is 281600 Routing Descriptor Blocks: 10.0.3.2, from Redistributed, Send flag is 0x0 Composite metric is (281600/0), Route is External Vector metric: Minimum bandwidth is 10000 Kbit Total delay is 1000 microseconds Reliability is 255/255 Load is 1/255 Minimum MTU is 1500 Hop count is 0 External data: Originating router is 3.3.3.3 (this system) AS number of route is 123 External protocol is BGP, external metric is 0 Administrator tag is 1 (0x00000001) Exterior flag is set |
When redistributing routes into OSPF, a route metric does not have to be specified during the redistribution. If not specified, OSPF uses the following default values:
- Redistributed routes from BGP are assigned a metric or cost of 1
- Redistributed routes from another OSPF process use the source routes cost
- All other redistributed routes are assigned a default metric of 20
As is the case with EIGRP, it is imperative to implement filtering when redistributing any BGP routes into OSPF. In addition to this, it is important to remember to use the subnets keyword when redistributing routes into OSPF. If this keyword is omitted, only Classful subnets will be redistributed. The following configuration example illustrates how to configure OSPF to redistribute only the default route from BGP:
| R3(config)#ip prefix-list DEFAULT-ONLY description ‘Only The Default Route’ R3(config)#ip prefix-list DEFAULT-ONLY seq 5 permit 0.0.0.0/0 R3(config)#route-map BGP-INTO-OSPF permit 10 R3(config-route-map)#description ‘Redistribute Only The Default Route’ R3(config-route-map)#match ip address prefix-list DEFAULT-ONLY R3(config-route-map)#exit R3(config)#route-map BGP-INTO-OSPF deny 20 R3(config-route-map)#description ‘Explicitly Deny All Other Routes’ R3(config-route-map)#exit R3(config)#router ospf 3 R3(config-router)#default-information originate R3(config-router)#redistribute bgp 123 subnets route-map BGP-INTO-OSPF R3(config-router)#exit |
NOTE: Regarding the output above, by default, the default route will not be installed into the LSDB unless thedefault-information originate command is issued under the OSPF process. Following this configuration, the LSDB on router R3 shows the following Type 5 LSA:
| R3#show ip ospf database external 0.0.0.0OSPF Router with ID (3.3.3.3) (Process ID 3)Type-5 AS External Link States
LS age: 50 |
NOTE: When redistributing into OSPF, keep in mind that you may need to issue the clear ip ospf redistributioncommand following the configuration change.
And finally, to conclude this section, the bgp redistribute-internal command must be used when redistributing iBGP routes into an IGP. By default, this behavior is disabled. The following configuration illustrates how to configure a local BGP speaker to redistribute iBGP-learned prefixes into an Interior Gateway Protocol:
| R3(config)#router bgp 123 R3(config-router)#bgp redistribute-internal R3(config-router)#exit |