OSPF Blog Content

OSPF - Open Shortest Path First

OSPF Explained Step By Step With Practicals From CCNA To CCIE Level

OSPFv3



* OSPFv3 allow a router to use ipv6 capability or can run OSPF using IPv6
* OSPF for ipv6 use IPv6 multicast address ff02::5 & ff02::6
* We have 2 ways to enable OSPFv3
         Ipv6 router ospf 1 //will just enable for IPv6
         Router ospfv3 1
                will enble to use for IPv4 and IPv6
                Will encapsulate all the control plane in IPv6 header in case of both IPv4 and IPv6
* While using only ipv6 address and neighbors we need to make sure
        RID should be configured manually
        Or we need to maintain a ipv4 active loopback address to pick as a router-ID,
        RID can only be a IPv4 address not an IPv6
* While enabling OSPF for IPv6 we need to enable global IPv6 routing first (ipv6 unicast-routing)

Lets enable OSPF using IPv6 router ospf 1

Router-3
ipv6 unicast-routing
ipv6 router ospf 1
exit
int range fastEthernet 0/0, loopback 0
ipv6 ospf 1 area 0
exit

Router-5
ipv6 unicast-routing
ipv6 router ospf 1
exit
int range fastEthernet 0/0, loopback 0
ipv6 ospf 1 area 0
exit

To verify the database
Router-3
Ipv6 router ospf data
Ipv6 ospf neighbor

Lets enable OSPF using router ospfv3 1
Router-3
ipv6 unicast-routing
router ospfv3 1
address-family ipv6 unicast
router-id 3.3.3.3 //Optional if router have active ipv4 loopback
exit
exit
interface range fastEthernet 0/0, loopback 0
ospfv3 1 ipv6 area 0
exit

Router-5
ipv6 unicast-routing
router ospfv3 1
address-family ipv6 unicast
router-id 5.5.5.5 //Optional if router have active ipv4 loopback
exit
exit
int range fastEthernet 0/0, loopback 0
ospfv3 1 ipv6 area 0
exit

To verify the database
Router-3
sh ospfv3 neighbor
sh ospfv3 database

STUB-ROUTER



This feature allows a router to either temporarily or permanently be prevented from becoming a transit router.

When we enable stub feature on OSPF router then router will do maximum matric of directly connected networks in own LSA-1 (router LSA). So that whenever R1 will compute SPF then R1 will not use path via R2 to reach R3 network.Then R1 will use another two path to reach R3 network and will perform load balancing.
Database of Router-2 before enabling STUB feature

Router-2 | Database | LSA-1 | Router-LSA
R2#show ip ospf database router 2.2.2.2
        OSPF Router with ID (2.2.2.2) (Process ID 1)
                 Router Link States (Area 0)
LS age: 102
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 2.2.2.2
Advertising Router: 2.2.2.2
LS Seq Number: 80000005
Checksum: 0x7D2A
Length: 60
Number of Links: 3

Link connected to: a Stub Network
(Link ID) Network/subnet number: 2.2.2.2
(Link Data) Network Mask: 255.255.255.255
Number of MTID metrics: 0
TOS 0 Metrics: 1

Link connected to: a Transit Network
(Link ID) Designated Router address: 23.0.0.2
(Link Data) Router Interface address: 23.0.0.2
Number of MTID metrics: 0
TOS 0 Metrics: 1


Link connected to: a Transit Network
(Link ID) Designated Router address: 12.0.0.2
(Link Data) Router Interface address: 12.0.0.2
Number of MTID metrics: 0
TOS 0 Metrics: 1

Here we can see the router R2 is advertising the normal metric value as per the metric calculation
Lets check the Routing table of Router-1 how that is installing the routes of R2

Router-1 Routing table
R1#show ip route ospf
Codes: L - local, 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, H - NHRP, l - LISP
         + - replicated route, % - next hop override

Gateway of last resort is not set


         2.0.0.0/32 is subnetted, 1 subnets
O         2.2.2.2 [110/2] via 12.0.0.2, 00:08:06, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
O         3.3.3.3 [110/3] via 15.0.0.5, 00:06:46, FastEthernet2/0
                  [110/3] via 14.0.0.4, 00:07:06, FastEthernet3/0
                  [110/3] via 12.0.0.2, 00:03:11, FastEthernet0/0

All the routes are being installed with default metric
We can enable this feature in 2 ways
        1. Unconditional (Always advertise max matric)
        2. Conditional (as per condition will advertise max metric)

Configuration: Unconditional
Configuration on Router-2
router ospf 1
max-metric router-lsa
exit

Database After enabling the max-metric on Router-2

Router-2 Database | Router LSA | LSA-1
R2#show ip ospf database router 2.2.2.2

         OSPF Router with ID (2.2.2.2) (Process ID 1)
                 Router Link States (Area 0)

Exception Flag: Announcing maximum link costs for topology Base with MTID 0
LS age: 12
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 2.2.2.2
Advertising Router: 2.2.2.2
LS Seq Number: 80000006
Checksum: 0x3375
Length: 60
Number of Links: 3

Link connected to: a Stub Network
(Link ID) Network/subnet number: 2.2.2.2
(Link Data) Network Mask: 255.255.255.255
Number of MTID metrics: 0
TOS 0 Metrics: 1

Link connected to: a Transit Network
(Link ID) Designated Router address: 23.0.0.2
(Link Data) Router Interface address: 23.0.0.2
Number of MTID metrics: 0
TOS 0 Metrics: 65535

Link connected to: a Transit Network
(Link ID) Designated Router address: 12.0.0.2
(Link Data) Router Interface address: 12.0.0.2
Number of MTID metrics: 0
TOS 0 Metrics: 65535

After enabling this feature, Router-2 is advertising all the links on higher metric, and other routers will not use this path because of the higher metric

Lets check on the Router-1

Router-1 Routing table
R1#show ip route ospf
Codes: L - local, 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, H - NHRP, l - LISP
+ - replicated route, % - next hop override

Gateway of last resort is not set

         2.0.0.0/32 is subnetted, 1 subnets
O         2.2.2.2 [110/2] via 12.0.0.2, 00:12:46, FastEthernet0/0
         3.0.0.0/32 is subnetted, 1 subnets
O         3.3.3.3 [110/3] via 15.0.0.5, 00:11:26, FastEthernet2/0
         [110/3] via 14.0.0.4, 00:11:46, FastEthernet3/0

Here we can see the path via Router-2 is removed from the table, because of the higher metric
Check the status on Router-2 for this feature

Router-2 | Feature Status Check
R2#show ip ospf
Routing Process "ospf 1" with ID 2.2.2.2
Start time: 00:02:56.580, Time elapsed: 00:15:10.560
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Supports NSSA (compatible with RFC 3101)
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
Originating router-LSAs with maximum metric
         Condition: always, State: active

The one we enables was the permanent metric change mechanism

Configuration: Unconditional (we will set condition for 60sec only)
Configuration on Router-2
router ospf 1
max-metric router-lsa on-startup 60
exit

In this condition it will advertise max-metric for only first 60 sec when the router will start/bootup

Configuration on Router-2
router ospf 1
max-metric router-lsa on-startup wait-for-bgp
exit

In this condition it will advertise max-metric until the BGP neighbors do not come up, once the BGP neighborship comes up it will stop advertising the max-metric

image
image
image
image