4-2 default-metric metric
< Free Open Study >
Syntax Description:
Purpose: To assign a metric or MED to routes that are redistributed into BGP. There are three methods for assigning the metric or MED for redistributed routes. The first is to not assign a metric when redistributing routes into BGP. If a metric value is not assigned, the value 0 is applied to the metric for redistributed routes. This occurs when you use the redistribute command with no metric assignment (see section 10-1 ). The second method is to assign a metric or MED value when redistributing a protocol into BGP (see section 10-2 ). The third method uses the default-metric command to assign a metric or MED to redistributed routes that have not had their metric value assigned by the redistribute command:
redistribute ospf 1— Assigns a metric of 0 to OSPF routes.
redistribute ospf 1 metric 5— Assigns a metric of 5 to OSPF routes.
redistribute ospf 1 metric 5
redistribute static
default-metric 10— Assigns a metric of 5 to OSPF routes and a metric of 10 to static routes.
Cisco IOS Software Release: 10.0
Configuration Example: Assigning Metrics to Redistributed Routes
In Figure 4-2 , Router B is redistributing OSPF and static routes into BGP. The OSPF routes are assigned a metric of 5 using the redistribute ospf 1 metric 5 command. The static routes are assigned a metric of 0 because we are not using the default-metric command or assigning a metric with the redistribute command.
Figure 4-2. Assigning Metrics to Redistributed Routes
Router A
router bgp 1
neighbor 172.17.1.1 remote-as 2
___________________________________________________________________________
Router B
router ospf 1
network 10.0.0.0 0.255.255.255 area 0
!
router bgp 2
redistribute ospf 1 metric 5
redistribute static
neighbor 172.17.1.2 remote-as 1
no auto-summary
!
ip route 198.8.4.128 255.255.255.128 Ethernet 0
___________________________________________________________________________
Router C
interface loopback 0
ip address 205.40.30.129 255.255.255.192
!
router ospf 1
network 10.0.0.0 0.255.255.255 area 0
network 205.0.0.0 0.255.255.255 area 51
Without the default-metric command on Router B, the static routes are assigned a metric of 0:
rtrB#show ip bgp
BGP table version is 5, local router ID is 172.16.2.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.1.0/30 0.0.0.0 0 32768 ?
*> 172.16.2.0/24 0.0.0.0 0 32768 ?
*> 198.8.4.128/25 0.0.0.0 0 32768 ?
*> 205.40.30.128/25 10.1.1.2 5 32768 ?
Now modify the BGP configuration on Router B and assign a default metric of 10:
Router B
router bgp 2
redistribute static
redistribute ospf 1 metric 5
neighbor 172.17.1.2 remote-as 1
default-metric 10
no auto-summary
Verification
Verify that the default metric has been applied only to the static route and not to the OSPF routes:
rtrB#show ip bgp
BGP table version is 5, local router ID is 172.16.2.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.1.0/30 0.0.0.0 0 32768 ?
*> 172.16.2.0/24 0.0.0.0 0 32768 ?
*> 198.8.4.128/25 0.0.0.0 10 32768 ?
*> 205.40.30.128/25 10.1.1.2 5 32768 ?
Troubleshooting
Step 1. Verify that the BGP neighbors are in the Established state using the show ip bgp neighbors command.
If the neighbor relationship is not in the Established state, see section 8-23 .
Step 2. The default metric will only be applied to redistributed routes that are not assigned a metric using the redistribute command.
Step 3. When redistributing routes, use the no auto-summary command (see section 2-1 )
< Free Open Study >