cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1546
Views
15
Helpful
16
Replies

Redistribute Static Routes into OSPF

akhran1974
Level 1
Level 1

I have three routers (RouterA, RouterB and RouterC) connected to the same LAN.

RouterA : 10.1.1.1/24

RouterB : 10.1.1.2/24

RouterC : 10.1.1.3/24

Router A is not running OSPF, but RouterB and RouterC are in the same ospf area 0. A static route is inserted into RouterB with the RouterA as the next hop gateway:

RouterB#

!

ip route 10.2.2.0 255.255.255.0 10.1.1.1

!

router ospf 1

redistribute static subnets

!

When this static route is advertised to RouterC via the redistribute command, RouterC's routing table is showing:

10.2.2.0/24 [110/20] via 10.1.1.1(Router A), Vlan1

Shouldn't it be

10.2.2.0/24 [110/20] via 10.1.1.2 (RouterB), Vlan1

instead, since the route was advertised to RouterC by RouterB?

Thanks !

16 Replies 16

Richard Burts
Hall of Fame
Hall of Fame

David

Since RouterA and RouterB are on a common subnet with RouterC it is much more efficient for RouterC to forward directly to RouterA than to forward to RouterB which would receive and then retransmit out the same interface. As the routers draw the topology map it becomes evident which is the most efficient forwarding path.

HTH

Rick

HTH

Rick

Rick,

Do you mean that the static route "10.2.2.0 255.255.255.0 10.1.1.1" gets advertised to RouterC and RouterC 'resolves' 10.1.1.1 as part of its connected interface and hence uses 10.1.1.1 as the next hop in its routing table?

Extending the example, I have a RouterD connected to another LAN on the second interfaces of RouterB and RouterC:

RouterA

|.1

|------------------------LAN1 (10.1.1.0/24)

|.2 |.3

RouterB RouterC

|.1 |.2

-------------------------LAN2 (192.168.1.0/24)

|.3

RouterD

If RouterD is in the same ospf area as RouterB and RouterC, when it received the static route redistribution from RouterB, will it insert

10.2.2.0/24 [110/20] via 192.168.1.1 (Router B)

or

10.2.2.0/24 [110/20] via 192.168.1.2 (RouterC)

if I have a static route in RouterD that says

!

ip route 10.1.1.1 255.255.255.255 192.168.1.2

!

will it 'resolve' 10.1.1.1 in the route advertisement "10.2.2.0 255.255.255.0 10.1.1.1" as having the best route through 192.168.1.2(RouterC) instead of the advertising RouterB?

Thanks!

David

The way it works is slightly different. If you want the details go read section 16.4 of RFC 2328 which is the definition of OSPF version 2. Section 16.4 describes the calculations involved in determining external routes. The essential concept is that the external LSA is generated by the router which redistributed the route and in the external LSA is a forwarding address which is the address to which packets should be forwarded. In your example RouterB generates an external LSA to RouterC and in it the forwarding address is 10.1.1.1. Here I have extracted several paragraphs from the RFC:

this LSA describes an AS external path to destination N. Examine the forwarding address specified in the AS-external-LSA. This indicates the IP address to which packets for the destination should be forwarded.

If the forwarding address is 0.0.0.0 then forward to the ASBR itself.

If the forwarding address is non-zero, look up the forwarding address in the routing table. The matching routing table entry must specify an intra-area or inter-area path.

So to get back to your example RouterB generates an external LSA (since it is the ASBR doing the redistribution) and it puts 10.1.1.1 into the forwarding address.

So when RouterC processes the external LSA it looks for its best path to 10.1.1.1 which turns out to be on the connected subnet.

And when RouterD processes the external LSA it looks into its routing table for its best path to 10.1.1.1. Will the best path be through RouterB, or through RouterC, or is it equal through each one?

HTH

Rick

HTH

Rick

Rick,

I have a static route "10.1.1.1 255.255.255.255 192.168.1.2 (RouterC)" in RouterD. In RouterD's routing table, I have

10.1.1.1/32 [1/0] via 192.168.1.2 (RouterC)

When RouterD processes the external LSA, as you mentioned, it looks for the best path to 10.1.1.1. However, in the routing table, I have

O E2 10.2.2.0/24 [120/20] via 192.168.1.1 (RouterB)

Shouldn't it be

O E2 10.2.2.0/24 [120/20] via 192.168.1.2 (RouterC)

after processing the LSA and finding the best path to 10.1.1.1 (based on the static route for 10.1.1.1 already in the routing table) ?

Also, what if RouterD looks into its routing table for best path to 10.1.1.1 and it does not have a route to 10.1.1.1? How will it then process the LSA? Since it does not have a route to 10.1.1.1, will it just ignore the LSA and does not insert a route for 10.2.2.0/24?

Thank you very much, it has been very informative.

Hi,

You must go through the RFC lines posted by Rick,

It says 'If the forwarding address is non-zero, look up the forwarding address in the routing table. The matching routing table entry must specify an intra-area or inter-area path. '

10.1.1.1/32 [1/0] via 192.168.1.2 (RouterC) is a static route. So, it won't reach '10.2.2.0/24' using this route.

For the below route :

O E2 10.2.2.0/24 [120/20] via 192.168.1.1 (RouterB)

I think, there would be an intra route to 10.0.0.0/24 network advertised by RouterB into area 0. So that RouterD uses this intra-area route to reach 10.1.1.1

if RouterD does not have any intra-area or inter-area route for 10.1.1.1, it ignores that LSA.

'If a router does not have an intra-area or inter-area route to the forwarding address, the LSA is ignored (section 16.4 (3) of RFC2328). It does not fall back to go through the ASBR.'

Thanks,

Vijaybabu

David

I am not clear about why RouterD would have RouterB instead of RouterC. Perhaps you could post the output of show ip ospf database external for the LSA for 10.2.2.0?

The answer to your second question is easier. If I had extracted the entire paragraph from the RFC it addresses your question about what if the forwarding address is not found in the routing table:

If the forwarding address is non-zero, look up the forwarding address in the routing table. The matching routing table entry must specify an intra-area or inter-area path; if no such path exists, do nothing with the LSA and consider the next in the list.

So yes if RouterD does not have a route to 10.1.1.1 then it ignores the LSA and does not insert a route.

[edit] my thanks to Vijaybabu for focusing better than I did on the aspect that OSPF looks for an intra area or inter area route to the forwarding address.

HTH

Rick

HTH

Rick

Hi Rick,

Those information are gathered from you only.

Thanks for supporting us.

Thanks,

Vijaybabu

Hi Rick/Vijaybabu,

RouterB

-------

RouterB#sh ip ro

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 2 subnets

S 10.2.2.0 [1/0] via 10.1.1.1

C 10.1.1.0 is directly connected, FastEthernet0/0

C 192.168.1.0/24 is directly connected, FastEthernet0/1

RouterB#

I have done a redistribute static subnets into ospf in RouterB.

RouterD

--------

RouterD#sh ip route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

O E2 10.2.2.0/24 [110/20] via 192.168.1.1, 00:08:12, FastEthernet0/0

S 10.1.1.1/32 [1/0] via 192.168.1.2

C 192.168.1.0/24 is directly connected, FastEthernet0/0

RouterD#

RouterD#sh ip ospf data exter

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

Type-5 AS External Link States

Routing Bit Set on this LSA

LS age: 559

Options: (No TOS-capability, DC)

LS Type: AS External Link

Link State ID: 10.2.2.0 (External Network Number )

Advertising Router: 192.168.1.1

LS Seq Number: 80000001

Checksum: 0x1E09

Length: 36

Network Mask: /24

Metric Type: 2 (Larger than any link state path)

TOS: 0

Metric: 20

Forward Address: 0.0.0.0

External Route Tag: 0

RouterD has a static route to 10.1.1.1 via RouterC (192.168.1.2), but it still select RouterB as the route to 10.1.1.1 as shown above.

In the ospf external database, why is the Forward Address 0.0.0.0? Shouldn't it be 192.168.1.2 since there is a route to 10.1.1.1?

RouterC

-------

RouterC#sh ip route

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 2 subnets

O E2 10.2.2.0 [110/20] via 192.168.1.1, 00:17:38, FastEthernet0/1

C 10.1.1.0 is directly connected, FastEthernet0/0

C 192.168.1.0/24 is directly connected, FastEthernet0/1

RouterC#

RouterC#sh ip ospf data exter

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

Type-5 AS External Link States

Routing Bit Set on this LSA

LS age: 168

Options: (No TOS-capability, DC)

LS Type: AS External Link

Link State ID: 10.2.2.0 (External Network Number )

Advertising Router: 192.168.1.1

LS Seq Number: 80000001

Checksum: 0x1E09

Length: 36

Network Mask: /24

Metric Type: 2 (Larger than any link state path)

TOS: 0

Metric: 20

Forward Address: 0.0.0.0

External Route Tag: 0

Shouldn't the Foward Address be 10.1.1.1 instead of 0.0.0.0? Since the Foward Address is 0.0.0.0, does it mean the routing table should show 192.168.1.1 as the next hop for 10.2.2.0/24 network?

RouterD with no route to 10.1.1.1

---------------------------------

I remove the static route in RouterD so that it no longer have a route to 10.1.1.1:

RouterD#sh ip route

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 1 subnets

O E2 10.2.2.0 [110/20] via 192.168.1.1, 00:16:42, FastEthernet0/0

C 192.168.1.0/24 is directly connected, FastEthernet0/0

RouterD#

RouterD#sh ip ospf data ext

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

Type-5 AS External Link States

Routing Bit Set on this LSA

LS age: 1397

Options: (No TOS-capability, DC)

LS Type: AS External Link

Link State ID: 10.2.2.0 (External Network Number )

Advertising Router: 192.168.1.1

LS Seq Number: 80000001

Checksum: 0x1E09

Length: 36

Network Mask: /24

Metric Type: 2 (Larger than any link state path)

TOS: 0

Metric: 20

Forward Address: 0.0.0.0

External Route Tag: 0

However, the route to 10.2.2.0/24 remain in the routing table. It doesn't seem to ignore the LSA.

Thank you everyone.

David

Something in your network has changed and if we knew what it was we might be able to explain this symptom.

In the original post RouterC had an OSPF route to 10.2.2.0 with 10.1.1.1 as the next hop:

10.2.2.0/24 [110/20] via 10.1.1.1(Router A), Vlan1

now it does not. Can you help us understand wht has changed in your network?

HTH

Rick

HTH

Rick

Hi,

In Router C,

Earlier the route was

10.2.2.0/24 [110/20] via 10.1.1.1(Router A), Vlan1

but now, it is

10.2.2.0 [110/20] via 192.168.1.1, 00:17:38, FastEthernet0/1

Actually, after you have extended the network, Router C is receiving external LSA from Router B only in subnet 192.168.1.0/24.

In this case, it won't advertise FA as 10.1.1.1, since they are not in the same subnet unlike in earlier case where they are all in same subnet 10.1.1.0.

In Router D,

Its obvious, since FA for the external LSA is 0.0.0.0, so it routes using 192.168.1.1 (Router B)

FA is advertised only if there is a non-ospf router in the subnet to reach the external network, but that is not case as the external LSA received from subnet 192.168.1.0/24.

For your statement 'RouterD has a static route to 10.1.1.1 via RouterC (192.168.1.2), but it still select RouterB as the route to 10.1.1.1 as shown above. '

I have already mentioned that though RouterD has static route to 10.1.1.1, but it should have an intra-area or inter-area path to 10.1.1.0 network, then only it prefer that FA.

Hope that helps.

Thanks,

Vijaybabu

My apologies. The following output should be the original situation before I simulated the situation of RouterD not having a route to 10.1.1.1:

RouterC#sh ip route

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 2 subnets

O E2 10.2.2.0 [110/20] via 10.1.1.1, 00:00:08, FastEthernet0/0

C 10.1.1.0 is directly connected, FastEthernet0/0

C 192.168.1.0/24 is directly connected, FastEthernet0/1

RouterC#

RouterC#sh ip ospf data ext

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

Type-5 AS External Link States

Routing Bit Set on this LSA

LS age: 244

Options: (No TOS-capability, DC)

LS Type: AS External Link

Link State ID: 10.2.2.0 (External Network Number )

Advertising Router: 192.168.1.1

LS Seq Number: 80000002

Checksum: 0xB167

Length: 36

Network Mask: /24

Metric Type: 2 (Larger than any link state path)

TOS: 0

Metric: 20

Forward Address: 10.1.1.1

External Route Tag: 0

RouterC#

After I made RouterD lost the route to 10.1.1.1 (10.1.1.0/24) by disabling ospf process on the 10.1.1.2 interface on RouterB and 10.1.1.3 interface on RouterC, I have the following output:

RouterD#sh ip route

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 1 subnets

O E2 10.2.2.0 [110/20] via 192.168.1.1, 00:00:01, FastEthernet0/0

C 192.168.1.0/24 is directly connected, FastEthernet0/0

RouterD#sh ip ospf data ext

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

Type-5 AS External Link States

Routing Bit Set on this LSA

LS age: 164

Options: (No TOS-capability, DC)

LS Type: AS External Link

Link State ID: 10.2.2.0 (External Network Number )

Advertising Router: 192.168.1.1

LS Seq Number: 80000003

Checksum: 0x1A0B

Length: 36

Network Mask: /24

Metric Type: 2 (Larger than any link state path)

TOS: 0

Metric: 20

Forward Address: 0.0.0.0

External Route Tag: 0

RouterD#

Now that RouterD does not have any route to 10.1.1.1, does that mean RouterD should ignore the LSA (even though it has a Forward Address of 0.0.0.0)?

How does RouterB determine if Forward Address should be filled with an ip address (like for RouterC above) or with 0.0.0.0 in the LSA sent out to his ospf neighbors?

Thanks.

Hi,

Q :Now that RouterD does not have any route to 10.1.1.1, does that mean RouterD should ignore the LSA (even though it has a Forward Address of 0.0.0.0)?

>>>> It won't ignore the external LSA because the advertsising router is reachable. Here, it won't bother about FA, since it is 0.0.0.0

Q :How does RouterB determine if Forward Address should be filled with an ip address (like for RouterC above) or with 0.0.0.0 in the LSA sent out to his ospf neighbors?

>>>> If the ASBR's next-hop router has an interface on a multi-access network that is part of the OSPF routing domain, then the ASBR advertises external-LSA with FA equal to the address of that next-hop router.

In your case, earlier, OSPF was enabled in subnet 10.1.1.0/24 and RouterA which is in the same subnet, is the next-hop router for 10.2.2.0/24.Hence, it was advertised in FA, so that RouterC which is in same subnet can forward traffic directly to RouterA instead of going through RouterB.

Then, you disabled OSPF in subnet 10.1.1.0/24( ie. in Routerb, RouterC), so OSPF doesn't know about this subnet.Hence, FA is 0.0.0.0.

Thanks,

Vijaybabu

(1) When I enable ospf on 10.1.1.2 interface in RouterB (RouterC's 10.1.1.3 interface is not running ospf), RouterC lost the route to 10.2.2.0/24.

RouterC

-------

RouterB#sh ip ospf nei

Neighbor ID Pri State Dead Time Address Interface

192.168.1.2 1 FULL/BDR 00:00:36 192.168.1.2 FastEthernet0/

1

192.168.1.3 1 FULL/DR 00:00:36 192.168.1.3 FastEthernet0/

1

RouterB#

RouterC#sh ip route

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 1 subnets

C 10.1.1.0 is directly connected, FastEthernet0/0

C 192.168.1.0/24 is directly connected, FastEthernet0/1

RouterC#

However, in the RouterC's ospf database, I have

RouterC#sh ip ospf data ext

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

Type-5 AS External Link States

LS age: 313

Options: (No TOS-capability, DC)

LS Type: AS External Link

Link State ID: 10.2.2.0 (External Network Number )

Advertising Router: 192.168.1.1

LS Seq Number: 80000002

Checksum: 0xB167

Length: 36

Network Mask: /24

Metric Type: 2 (Larger than any link state path)

TOS: 0

Metric: 20

Forward Address: 10.1.1.1

External Route Tag: 0

RouterC#

If I disable ospf on RouterB's 10.1.1.2 interface, RouterC will regain the route to 10.2.2.0/24 via 192.168.1.1

Any reason why RouterC does not have a route to 10.2.2.0/24 when ospf is enabled on RouterB's 10.1.1.2 interface?

(2) When I add a static route "ip route 10.1.1.0 255.255.255.0 192.168.1.2" into RouterD, Router D also lost the route to 10.2.2.0/24.

RouterD

-------

RouterD#sh ip route

Gateway of last resort is not set

10.0.0.0/24 is subnetted, 1 subnets

S 10.1.1.0 [1/0] via 192.168.1.2

C 192.168.1.0/24 is directly connected, FastEthernet0/0

RouterD#sh ip ospf data ext

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

Type-5 AS External Link States

LS age: 246

Options: (No TOS-capability, DC)

LS Type: AS External Link

Link State ID: 10.2.2.0 (External Network Number )

Advertising Router: 192.168.1.1

LS Seq Number: 80000008

Checksum: 0xA56D

Length: 36

Network Mask: /24

Metric Type: 2 (Larger than any link state path)

TOS: 0

Metric: 20

Forward Address: 10.1.1.1

External Route Tag: 0

RouterD#

From RouterD I'm able to ping 10.1.1.1. Any reason why RouterD will drop the route to 10.2.2.0/24 ?

Thanks !

The forwarding address (10.1.1.1) on RouterD has to be learned via OSPF but you have a static route to network 10.1.1.0/24. You would have to either suppress the fa and make it 0.0.0.0 or advertise 10.1.1.1 via OSPF to RouterD for it to use that route.

HTH

Sundar

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card