Thursday 25 October 2012

Configuring Default route in OSPF


Configuring Default route in OSPF:

 
·         Let me take a small topology to configure default route in OSPF

 
R1------S1/0-------------s1/0----R2----s1/1--------------s1/1------R3

10.1.12.1--------------10.1.12.2-----10.1.13.2--------------10.1.13.3

 

·         Configured OSPF between R1-R2

·         Trying to configure in R2, so that it will generate default route towards R1

 

R1(config-router)#do show run | sec router

router ospf 1

 log-adjacency-changes

 network 10.1.12.1 0.0.0.0 area 0

R1(config-router)#

R1(config-router)#do 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/32 is subnetted, 1 subnets

C       1.1.1.1 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.12.0 is directly connected, Serial1/0

R1(config-router)#

 

R2(config-router)#do show run | sec router

router ospf 1

 log-adjacency-changes

 network 10.1.12.2 0.0.0.0 area 0

R2(config-router)#

R2(config-router)#do 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

 

     2.0.0.0/32 is subnetted, 1 subnets

C       2.2.2.2 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 2 subnets

C       10.1.13.0 is directly connected, Serial1/1

C       10.1.12.0 is directly connected, Serial1/0

R2(config-router)#

 

·         Let me configure a default route in R2, towards R1:

 

R2(config-router)#default-information originate

 

R1(config-router)#do 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/32 is subnetted, 1 subnets

C       1.1.1.1 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.12.0 is directly connected, Serial1/0

R1(config-router)#

 

Observation:

·         R1 don’t see default route in its routing table

·         This is because R2 doesn’t have any default route in its routing table.

·         If we want R2 to generate a default route irrespective of default route in its routing table, then we need to use always keyword

 

R2(config-router)#default-information originate always

 

R1(config-router)#do 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 10.1.12.2 to network 0.0.0.0

 

     1.0.0.0/32 is subnetted, 1 subnets

C       1.1.1.1 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.12.0 is directly connected, Serial1/0

O*E2 0.0.0.0/0 [110/1] via 10.1.12.2, 00:00:03, Serial1/0

R1(config-router)#

 

Observation:

·         Now, R1 has default route in its routing table

·         If we want R2 to generate default route only if its Serial 1/1 link is up, then we need to use a route-map keyword along with default-information originate.

 

 

R2(config-router)#default-information originate always route-map CONN

R2(config-router)#do show run | begin CONN

 default-information originate always route-map CONN

!

ip forward-protocol nd

!

!

ip http server

no ip http secure-server

!

access-list 1 permit 10.1.13.0 0.0.0.255 log

!

route-map CONN permit 10

 match ip address 1

!

 

·         Now, if I shut the ser1/1 interface in R2, then default-route in R1 should disappear:

 

R2(config)#int ser1/1

R2(config-if)#shut

R2(config-if)#

*Mar  1 00:42:36.563: %LINK-5-CHANGED: Interface Serial1/1, changed state to administratively down

*Mar  1 00:42:37.563: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to down

R2(config-if)#

 

R1(config-router)#do 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/32 is subnetted, 1 subnets

C       1.1.1.1 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.12.0 is directly connected, Serial1/0

R1(config-router)#

 

·         Yes, default route in R1 has disappeared now

 

R2(config-if)#no shut

R2(config-if)#

*Mar  1 00:43:03.447: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up

R2(config-if)#

*Mar  1 00:43:04.451: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up

R2(config-if)#

 

 

R1(config-router)#do 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 10.1.12.2 to network 0.0.0.0

 

     1.0.0.0/32 is subnetted, 1 subnets

C       1.1.1.1 is directly connected, Loopback0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.12.0 is directly connected, Serial1/0

O*E2 0.0.0.0/0 [110/1] via 10.1.12.2, 00:00:13, Serial1/0

R1(config-router)#

 

Observation:

·         Default route in R1 is back!

 

 

No comments:

Post a Comment