redistribute

Configures the device to redistribute IPv4 and IPv6 routes from one routing domain to another.
Syntax
redistribute { ospf } [ match [ external1 | external2 | internal ] | metric num | route-map string ]
redistribute { source-protocol } [ metric num | metric-type { type1 | type2 } | route-map string ]
no redistribute { ospf } [ match [ external1 | external2 | internal ] ] [ metric num ] [ route-map string ]
no redistribute { source-protocol } [ metric num ] [ metric-type { type1 | type2 } ] [ route-map string ]
Command Default

The device does not redistribute routing information.

Parameters
match
Specifies the type of route.
external1
Specifies OSPF Type 1 external routes.
external2
Specifies OSPF Type 2 external routes.
internal
Specifies OSPF internal routes.
source-protocol
Specifies the source protocol from which routes are being redistributed. It can be one of the following keywords: bgp, connected, ospf, rip, or static.
metric num
Specifies a metric for redistributed routes. Range is from 0 through 65535. No value is assigned by default.
route-map string
Specifies a route map to be consulted before a route is added to the routing table.
metric-type
Specifies the external link type associated with the default route advertised into the OSPF routing domain.
type1
Specifies a type 1 external route.
type2
Specifies a type 2 external route.
level-1
Specifies level-1 routes.
level-1-2
Specifies both level-1 and level-2 routes.
level-2
Specifies level-2 routes.
Modes

BGP configuration mode

BGP address-family IPv6 unicast configuration mode

BGP address-family IPv4 unicast VRF configuration mode

BGP address-family IPv6 unicast VRF configuration mode

OSPF router configuration mode

OSPFv3 router configuration mode

OSPF router VRF configuration mode

OSPFv3 router VRF configuration mode

Usage Guidelines

Routes can be filtered by means of an associated route map before they are distributed.

The metric-type { type1 | type2 } option is only available in OSPFv3 router configuration mode and OSPFv3 router VRF configuration mode.

The match, metric, and metric-type options are not available in OSPF router configuration mode and OSPF router VRF configuration mode.

Note: The default-metric command does not apply to the redistribution of directly connected routes. Use a route map to change the default metric for directly connected routes.

The no form of the command restores the defaults.

Examples

The following example redistributes OSPF external type 1 routes.

device# configure terminal
device(config)# router bgp
device(config-bgp)# redistribute ospf match external1

The following example redistributes OSPF routes with a metric of 200.

device# configure terminal
device(config)# router bgp
device(config-bgp)# redistribute ospf metric 200

The following example redistributes OSPFv3 external type 2 routes in VRF instance "red".

device# configure terminal
device(config)# router bgp
device(config-bgp)# address-family ipv6 unicast vrf red
device(config-bgp-ipv6u-vrf)# redistribute ospf match external2

The following example redistributes static routes into BGP4+ and specifies a metric of 200.

device# configure terminal
device(config)# router bgp
device(config-bgp)# address-family ipv6 unicast
device(config-bgp-ipv6u)# redistribute static metric 200

The following example redistributes RIP routes and specifies that route-map "rm2" be consulted in BGP address-family IPv6 unicast configuration mode.

device# configure terminal
device(config)# router bgp
device(config-bgp)# address-family ipv6 unicast
device(config-bgp-ipv6u)# redistribute rip route-map rm2

The following example redistributes BGP routes and specifies that route-map "rm7" be consulted in OSPF router configuration mode.

device# configure terminal
device(config)# router ospf
device(config-ospf-router)# redistribute bgp route-map rm7

The following example redistributes OSPF routes and specifies a type1 external route in OSPFv3 VRF configuration mode.

device# configure terminal
device(config)# ipv6 router ospf
device(config-ospf6-router)# redistribute ospf metric-type type1