07-25-2011 08:23 AM - edited 03-04-2019 01:05 PM
I wonder if it is possible to see alternative routes for ospf and bgp.
For example if the router selects route x with metric y, can i see what is the next possible route if x with y dies?
I know that in Eirgp i could see the successors in the table.
thx
07-25-2011 08:27 AM
Bart
For bgp you can look at the BGP routing table - "sh ip bgp"
For OSPF you can look at the OSPF database "sh ip ospf database" although be aware you are looking at LSA not specifically routes.
Jon
07-25-2011 02:32 PM
Yes i noticed that routes that were choosen through bgp show as:
router# sh ip route 10.11.0.1
Routing entry for 10.11.0.0/23
Known via "bgp 64754", distance 20, metric 0
Tag 65000, type external
Redistributing via ospf 10
Advertised by ospf 10 metric 50 metric-type 1 subnets
Last update from xxxx 4w5d ago
Routing Descriptor Blocks:
* xxxx, from xxxx, 4w5d ago
Route metric is 0, traffic share count is 1
AS Hops 2
and ospf shows:
router#show ip ospf database | include 10.11.0.0
10.11.0.0 10.11.0.2 73 0x8000135D 0x0089FA 0
10.11.0.0 10.100.7.14 801 0x80000594 0x008A61 65000
10.11.0.0 10.200.7.14 365 0x80000595 0x006521 65000
what i was wondering is that i could see the metric for the routes that did not get to the routing table
thx
07-26-2011 03:49 AM
Hi,
regarding metric:
"Routing entry for 10.11.0.0/23
Known via "bgp 64754", distance 20, metric 0"
metric 0 here is the BGP metric (MED attribute) received with the 10.11.0.0/23 perfix.
"Redistributing via ospf 10
Advertised by ospf 10 metric 50 metric-type 1 subnets"
is showing the OSPF metric assigned to the prefix when redistributed to OSPF.
You should be able to see this metric by issuing
show ip ospf database external 10.11.0.0
command.
HTH,
Milan
07-26-2011 07:56 AM
yes you are right, i can see it.
So now becuase the routes came from bgp into ospf with metric 50, they wil always come back from ospf with metric 50 because they are external routes?
router#show ip ospf database external 10.11.0.0
OSPF Router with ID (10.100.7.14) (Process ID 10)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS age: 363
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.11.0.0 (External Network Number )
Advertising Router: 10.11.0.2
LS Seq Number: 8000137E
Checksum: 0x471C
Length: 36
Network Mask: /23
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
LS age: 392
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.11.0.0 (External Network Number )
Advertising Router: 10.100.7.14
LS Seq Number: 800005B2
Checksum: 0x4E7F
Length: 36
Network Mask: /23
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 50
Forward Address: 0.0.0.0
External Route Tag: 65000
Routing Bit Set on this LSA
LS age: 1806
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.11.0.0 (External Network Number )
Advertising Router: 10.200.7.14
LS Seq Number: 800005B2
Checksum: 0x2B3E
Length: 36
Network Mask: /23
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 50
Forward Address: 0.0.0.0
External Route Tag: 65000
router#
if i look at different network where I have:
bgp -ospf router4 ----------------------------MPLS-------------------------------------bgp -ospf router3
| |
| |
| |
| |
| |
| |
router 1-ospf-----------------------200M LInk Ethernet------------------------------router 2-ospf
both ospf routers inject bgp into ospf with metric 50
all routers run ospf area 0.0.0.0
router 3#show ip route 10.100.0.0
Routing entry for 10.100.0.0/16
Known via "bgp 64754", distance 20, metric 0
Tag 65000, type external
Redistributing via ospf 10
Advertised by ospf 10 metric 50 metric-type 1 subnets
Last update from XXXX 1 7w0d ago
Routing Descriptor Blocks:
* XXXX, from XXXX, 7w0d ago
Route metric is 0, traffic share count is 1
AS Hops 2
Now i want to find out what are the candidate routes.
I want to see what metric are the routes for same network coming from:
router1 and router 2. Those are internal and both router 1 and route 2 know them.
But, router 1 also sends them to router 4 and then 4 distributes them to BGP so they will come to router 3 through BGP and this is how i want it for now. But I want to see what router 3 also sees as candidates and what metric they show. So:
router3#show ip ospf database external 10.100.0.0
OSPF Router with ID (10.200.7.14) (Process ID 10)
Type-5 AS External Link States
Routing Bit Set on this LSA
LS age: 1679
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 10.100.0.0 (External Network Number )
Advertising Router: 10.100.7.1
LS Seq Number: 80001C07
Checksum: 0x1802
Length: 36
Network Mask: /16
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
I see metric 20, but because administratice distance for bpg route is 20 and ospf 110 the bgp route wins.
thx again for help
07-26-2011 09:05 AM
Hi,
if you are running mutual BGP/OSPF route redistribution without any tunning on your routers,
you can create suboptimal routing or even routing loops easily, I'm afraid.
Imagine following scenario:
Your MPLS connection fails on router 3.
As router 3 would keep receiving 10.11.0.0/23 prefix via OSPF (btw, metric higher than 50 as you are using type 1 metric) and not via BGP anymore, it will redistribute it to BGP.
With the attribute weight=32768 by default.
When the MPLS connection recovers again, router 3 will receive 10.11.0.0/23 prefix via BGP again. But due to the same prefix available in the BGP table already with the high weight attribute value, it will not consider the prefix received as the best within BGP process.
So it will keep routing to 10.11.0.0/23 prefix through the OSPF cloud.
So you should think what you really need/want here and probably add some prefix tagging and BGP attribute manipulation to your configurations.
HTH,
Milan
07-26-2011 10:05 AM
but would not the router 3 select bgp because of administrative distance?
07-27-2011 03:46 AM
Hi,
no, as it would have the same prefix in the BGP table already (redistributed from OSFP) with better BGP attributes.
See
https://supportforums.cisco.com/message/3372479#3372479
for similar problem discussion.
HTH,
Milan
07-27-2011 02:26 PM
so to understand the routing better I created a test environment:
bgp 64000 -ospf 10 - router4 bgp 64000 -ospf 10 router3
----------------------------bgp 65000----r5---------------------------------
| |
| |
| |
| |
| |
| |
router 1-ospf 10 -----------------------1G------------------------------router 2-ospf 10
the r4 and r3 redistributes ospf 10 to bgp process 64000 and bgp distibutes them to 65000
so the router5 learns about router 1 and router 2 networks from ospf through bpg
and learns about 4 and 3 through bgp
What is strange is that when i cut the link from router 1 to router 2
the routes on router 5 that came from ospf through bgp show in routing table as:
B 10.100.8.0 [20/2] via 2.2.2.2 , from router 3
B 10.100.7.0 [20/0] via 1.1.1.1 , - from router 4
B 10.200.7.0 [20/0] via 2.2.2.2 , - from router 3
but they never get redistibuted to router 4 although the command:
show ip bgp neigh 1.1.1.1 advertised-routes , show:
*> 10.100.8.0/24 2.2.2.2 2 0 64000 ?
*> 10.200.7.0/24 2.2.2.2 0 0 64000 ?
the router5 bgp process is configured as:
router bgp 65000
redistribute connected
neighbor 1.1.1.1 remote-as 64000
neighbor 2.2.2.2 remote-as 64000
no auto-summary
why router 3 does not learn about those networks?
do i need to tell router5 about 10.100.0.0/24 and 10.200.0.0/24
and put a statement
network 10.100.0.0
network 10.200.0.0
07-28-2011 01:33 AM
Hi,
r4 is dropping the prefixes originated from r3 as you are using the same AS number 64000 on both routers but the prefix is received through eBGP from r5.
HTH,
Milan
07-28-2011 01:48 PM
Changing as to 63000 on r3 did the trick and now routes are distributed.
I wonder how come it works in our real live example where AS-es are the same?
I assume the prefixes are also received through the EBGP and both routers point to same AS neighboor.
Regardng the routing loops,in my test environment I created on r5 2 interfaces with static ips:
3.3.3.3
4.4.4.4
they are both distributed to router 4 and 3
router 3 shows:
Router#show ip bgp
BGP table version is 24, local router ID is 10.200.7.14
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 2.2.2.100 0 0 65000 ?
* 2.2.2.0/24 2.2.2.100 0 0 65000 ?
*> 0.0.0.0 0 32768 ?
*> 3.3.3.0/24 2.2.2.100 0 0 65000 ?
*> 4.4.4.0/24 2.2.2.100 0 0 65000 ?
*> 10.100.7.0/24 2.2.2.100 0 65000 64000 ?
*> 10.100.8.0/24 10.200.7.1 2 32768 ?
*> 10.200.7.0/24 0.0.0.0 0 32768 ?
Router#
so it receives info from 2.2.2.100 router 5 about those two routes:3.3.3.3and 4.4.4.4
now i will intentionaly shut the interface on router 5 to kill link to router 3
after that router 3:
Router#
*Jul 28 15:29:48.900: %BGP-5-ADJCHANGE: neighbor 2.2.2.100 Down BGP Notification sent
*Jul 28 15:29:48.900: %BGP-3-NOTIFICATION: sent to neighbor 2.2.2.100 4/0 (hold time expired) 0 bytes
Router#
Router#
Router#
Router#show ip bgp
BGP table version is 30, local router ID is 10.200.7.14
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/24 10.200.7.1 4 32768 ?
*> 2.2.2.0/24 0.0.0.0 0 32768 ?
*> 10.100.7.0/24 10.200.7.1 3 32768 ?
*> 10.100.8.0/24 10.200.7.1 2 32768 ?
*> 10.200.7.0/24 0.0.0.0 0 32768 ?
Router#
Router#
Router#
Router#show ip rou
Router#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/4] via 10.200.7.1, 00:01:42, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, GigabitEthernet1/0
3.0.0.0/24 is subnetted, 1 subnets
O E1 3.3.3.0 [110/54] via 10.200.7.1, 00:01:08, FastEthernet0/0
4.0.0.0/24 is subnetted, 1 subnets
O E1 4.4.4.0 [110/54] via 10.200.7.1, 00:01:08, FastEthernet0/0
10.0.0.0/24 is subnetted, 3 subnets
O 10.100.8.0 [110/2] via 10.200.7.1, 00:28:13, FastEthernet0/0
O 10.100.7.0 [110/3] via 10.200.7.1, 00:01:42, FastEthernet0/0
C 10.200.7.0 is directly connected, FastEthernet0/0
Router#
so the routes to 3.3.3.3 and 4.4.4.4 are now learned through ospf
i trace route:
Router#trace 4.4.4.4
Type escape sequence to abort.
Tracing the route to 4.4.4.4
1 10.200.7.1 12 msec 4 msec 20 msec
2 10.100.8.100 24 msec 4 msec 60 msec
3 10.100.7.14 44 msec 36 msec 40 msec
4 1.1.1.100 76 msec 44 msec *
now i bring the link back so bgp reinjects the routes back to r3
Router#
*Jul 28 15:35:27.068: %BGP-5-ADJCHANGE: neighbor 2.2.2.100 Up
Router#show ip bgp
BGP table version is 32, local router ID is 10.200.7.14
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 1.1.1.0/24 2.2.2.100 0 0 65000 ?
*> 10.200.7.1 4 32768 ?
* 2.2.2.0/24 2.2.2.100 0 0 65000 ?
*> 0.0.0.0 0 32768 ?
*> 3.3.3.0/24 2.2.2.100 0 0 65000 ?
*> 4.4.4.0/24 2.2.2.100 0 0 65000 ?
* 10.100.7.0/24 2.2.2.100 0 65000 64000 ?
*> 10.200.7.1 3 32768 ?
* 10.100.8.0/24 2.2.2.100 0 65000 64000 ?
*> 10.200.7.1 2 32768 ?
* 10.200.7.0/24 2.2.2.100 0 65000 64000 ?
*> 0.0.0.0 0 32768 ?
Router#trace 4.4.4.4
Type escape sequence to abort.
Tracing the route to 4.4.4.4
1 2.2.2.100 16 msec 4 msec *
Router#
and as you can see the bgp route wins again?
07-29-2011 12:56 AM
Hi,
in real life your MPLS provider would use neighbor as-override command.
Or you could use allowas-in command.
Reagrding your example: Are you redistributing OSPF to BGP on R3?
HTH,
Milan
07-29-2011 07:36 AM
in my test environment i use:
Version 12.3(23), RELEASE SOFTWARE (fc5)
and the as-override is not available
regarding example R3:
router ospf 10
router-id 10.200.7.14
log-adjacency-changes
redistribute bgp 63000 metric 50 metric-type 1 subnets
network 2.2.2.0 0.0.0.255 area 0.0.0.0
network 10.200.7.14 0.0.0.0 area 0.0.0.0
!
router bgp 63000
no synchronization
bgp log-neighbor-changes
redistribute connected
redistribute ospf 10
neighbor 2.2.2.100 remote-as 65000
no auto-summary
!
I am learning routing so i was curious why the expected route was not created as you said?
07-29-2011 07:47 AM
You might need to add
router bgp 63000
redistribute ospf 10 match external ...
(and internal plus possible more options)
to get the prefix received from BGP originally redistributed.
HTH,
Milan
07-29-2011 12:15 PM
yes, once i added external the route was created the way you explained
and it never got back to original shorter route after link to r5 from r3 recovered
r3 before the link is cut
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 2.2.2.100 0 0 65000 ?
r3 after the link is cut
Network Next Hop Metric LocPrf Weight Path
*> 3.3.3.0/24 10.200.7.1 54 32768 ?
r3 after link is restored
Network Next Hop Metric LocPrf Weight Path
* 3.3.3.0/24 2.2.2.100 0 0 65000 ?
*> 10.200.7.1 54 32768 ?
so this is how i understand it:
R5 distibutes 3.3.3.0/24 with weight 32768 to both r3 and r4. (why it shows 0 in R3 table)
(Routes that are injected to bgp from osp and distributed by ebgp with weight 0.)
they become active routes and and redistributed to ospf
Both r3 r4 at some point receive duplicate route about 3.3.3.0/24 from each other
with from ospf and they inject it to BGP.
When they are injected to BGP, bgp receives them and sets weight 32768 , but because it is as what is already in the routing table, they disregard it and keep initial route active ???
When link from r5 to r3 dies, the r3 removes route with metric 32768 and receives new from r4 that is redistributed by ospf and injects it with weight 32768 to bgp, and then like you said then link comes back nothing changes, cause the weight is the same. So to make this work the weight from BGP must be higher then from BGP through OSPF?
Where the weight should be manipulated? I assume that at the point when routes are incjeted from OSPF to BGP?
Why routes from BGP show weight 0?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide