redistribute bgp in ospf - 0.0.0.0/0 network

Prepare to pass CCNA, CCDA, CCIP, CCDP, CCNP, CCIE and specializations.

Moderator: sva

redistribute bgp in ospf - 0.0.0.0/0 network

Postby Alex Berdan on Fri Jul 09, 2010 10:05 am

would redistribution of BGP to OSPF take the 0.0.0.0/0 network by default?

doing a test I found that it says that it's doing it but when I check the neighbor it's not really taking the 0/0 in consideration:

Code: Select all
router ospf 1
router-id 192.168.2.1
log-adjacency-changes
redistribute bgp 2 metric 100 metric-type 1 subnets
network 10.0.0.5 0.0.0.0 area 1
!
router bgp 2
no synchronization
bgp log-neighbor-changes
neighbor 10.0.0.1 remote-as 1
no auto-summary


Code: Select all
R2#sh ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
  Known via "bgp 2", distance 20, metric 0, candidate default path
  Tag 1, type external
  Redistributing via ospf 1
  Last update from 10.0.0.1 04:53:56 ago
  Routing Descriptor Blocks:
  * 10.0.0.1, from 10.0.0.1, 04:53:56 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 1
Alex Berdan
 

Re: redistribute bgp in ospf - 0.0.0.0/0 network

Postby Conwyn on Fri Jul 09, 2010 10:05 am

Hi Alex

You might need the originate keyword.


Regards Conwyn
Conwyn
 

Re: redistribute bgp in ospf - 0.0.0.0/0 network

Postby Alex Berdan on Fri Jul 09, 2010 10:06 am

I know that "originate" it's fixing the issue but I've never known this is a default behavior!

do you know where I could find this in cisco docs?
Alex Berdan
 

Re: redistribute bgp in ospf - 0.0.0.0/0 network

Postby Keith Barker on Fri Jul 09, 2010 10:06 am

I didn't see a specific reference in the online docs for this behavior.
On the router doing the redistribution, if we do a show ip ospf database, the default route isn't in the database.


Best wishes,
Keith
Keith Barker
 

Re: redistribute bgp in ospf - 0.0.0.0/0 network

Postby Scott Morris on Fri Jul 09, 2010 10:07 am

Let's try it!

Code: Select all
emanon-Bellerive(config)#do sh ip ro b
B*   0.0.0.0/0 [20/0] via 74.143.0.45, 12:09:02
               [20/0] via 74.143.0.33, 12:09:02
emanon-Bellerive(config)#router ospf 1
emanon-Bellerive(config-router)#network 10.10.100.0 0.0.0.255 area 0
emanon-Bellerive(config-router)#redist bgp 10340 sub
emanon-Bellerive(config-router)#do sh ip o d

            OSPF Router with ID (206.81.23.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
206.81.23.1     206.81.23.1     5           0x80000002 0x002121 1

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
206.81.23.0     206.81.23.1     4           0x80000001 0x003709 0
emanon-Bellerive(config-router)#sh ip o d e

            OSPF Router with ID (206.81.23.1) (Process ID 1)

                Type-5 AS External Link States

  LS age: 26
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 206.81.23.0 (External Network Number )
  Advertising Router: 206.81.23.1
  LS Seq Number: 80000001
  Checksum: 0x3709
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 1
        Forward Address: 0.0.0.0
        External Route Tag: 0

We see a route there, but not the default!


emanon-Bellerive(config)#do sh ip bgp
BGP table version is 15, local router ID is 206.81.23.1
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
*> 0.0.0.0          74.143.0.45              0             0 36727 i
*                   74.143.0.33              0             0 36727 i
*> 206.81.23.0      0.0.0.0                  0         32768 i
emanon-Bellerive(config)#

So we only got the internally advertised route, but NOT the externally learned 0/0 one.... (Which is actually interesting considering I didn't do "bgp redistribute-internal" anywhere)

What about prefix-list?
Code: Select all
emanon-Bellerive(config)#ip prefix-list default permit 0.0.0.0/0
emanon-Bellerive(config)#route-map B2O permit 10
emanon-Bellerive(config-route-map)#match ip address prefix default
emanon-Bellerive(config-route-map)#exit
emanon-Bellerive(config)#
emanon-Bellerive(config)#router ospf 1
emanon-Bellerive(config-router)#redist bgp 10340 sub route-map B2O
emanon-Bellerive(config-router)#

emanon-Bellerive(config-router)#do sh ip o d ex

            OSPF Router with ID (206.81.23.1) (Process ID 1)
emanon-Bellerive(config-router)#


Well, now we actually get nothing. The 0/0, although matched, is not "allowed" to come in to OSPF. As noted above, using the default-information command will allow you to bring in the default route. OSPF is mildly protective.


Scott
Scott Morris
 

Re: redistribute bgp in ospf - 0.0.0.0/0 network

Postby Alex Berdan on Fri Jul 09, 2010 10:07 am

<from OSPF command ref. guide>

Whenever you use the redistribute or the default-information router configuration command to redistribute routes into an OSPF routing domain, the Cisco IOS software automatically becomes an Autonomous System Boundary Router (ASBR). However, an ASBR does not, by default, generate a default route into the OSPF routing domain. The software still must have a default route for itself before it generates one, except when you have specified the always keyword. When a route map is used, the origination of the default route by OSPF is not bound to the existence of a default route in the routing table.

it might be a protection mechanism as Scott is saying.

Thanks for all your thoughts guys.
Alex Berdan
 


Return to Cisco Career Certifications

Who is online

Users browsing this forum: No registered users and 4 guests

cron