Routing protocol OSPF

From Ever changing code
Jump to navigation Jump to search

OSPF States

Operation State Description
Establish
neighbor
adjacencies
1. Down state Negotiate master / slave relationship and DBD packet sequence number.
The master initiates the DBD packet exchange.
2. Init state Hello packets are received from the neighbor.
They contain the sending router’s Router ID.
Transition to Two-Way state.
3. Two-Way state On Ethernet links, elect a DR, and a BDR.
Transition to ExStart state.
Synchronize
OSPF
Databases
4. ExStart state Negotiate master / slave relationship and DBD packet sequence number.
The master initiates the DBD packet exchange.
5. Exchange state Routers exchange DBD packets.
If additional router information is required then transition to Loading; otherwise, transition to Full.
6. Loading state LSRs and LSUs are used to gain additional route information.
Routes are processed using the SPF algorithm.
Transition to the Full state.

7. Full state Routers have converged.

OSPFv2 router configuration for IPv4 protocol

r1(config)# router ospf process-id     !value between 1 - 65535, does not need to be unique on all routers
r1(config-router)# router-id x.x.x.x        !value in IPv4 format
r1(config-router)# network network-address wildcard-mask area area-id
r1(config-router)# network intf-ip-address 0.0.0.0       area area-id  !enabling advertisements via a quad 0 wildcard mask,
                                                                       !tells the router to enable interface Serial0/0/0 for the routing process
r1(config-router)# passive-interface intf
r1(config-router)# passive-interface default
r1(config-router)# auto-cost reference-bandwidth 100    !note bandwidth value here is Mb/s
r1(config-router)# ip ospf cost value                   !sets cost of the link

OSPFv3 router configuration for IPv6 protocol

If no extra description is used it says that the command has the same meaning both in OSPFv2 and OSPFv3

r1(config)# router ospf ospf-process-id
r1(config-router)# router-id x.x.x.x
r1(config-router)# network network-address wildcard-mask area area-id
r1(config-router)# network intf-ip-address 0.0.0.0       area area-id  !enabling advertisements via a quad 0 wildcard mask,
                                                                       !tells the router to enable interface Serial0/0/0 for the routing process
r1(config-router)# passive-interface intf
r1(config-router)# passive-interface default
r1(config-router)# auto-cost reference-bandwidth 100    !note bandwidth value here is Mb/s
r1(config-router)# ip ospf cost value                   !sets cost of the link

Cisco routers use IPv6 link-local addresses FE80:: to exchange LSA packets. The link-local address is automatically generated when IPv6 global unicast address is assigned to the interface. Cisco routers create the link-local address using FE80::/10 prefix and the EUI-64 process. EUI-64 involves using the 48-bit Ethernet MAC address, inserting FFFE in the middle and flipping the seventh bit. For serial interfaces, Cisco uses the MAC address of an Ethernet interface. The link local address can be assigned manually:

r1(config-if)# ipv6 address fe80::1 link-local

Adjusting the Interface Bandwidth

r1(config)# interface serial 0/0/1
r1(config-if)# bandwidth 64
r1(config-if)# end

Setting router-id

Option 1 via loopback interface

r1(config)# interface loopback 0
r1(config-if)# ip address 1.1.1.1 255.255.255.255    !creates a host route, a 32-bit host route does not get advertised as a route to other OSPF routers
r1(config-if)# end

Option 2 via router config

r1(config-router)# router-id x.x.x.x   !value in IPv4 format

Option 3 it will be the highest IPv4 active interface address in up state.

Differences between OSPFv2 vs OSPFv3


OSPFv2 OSPFv3
Advertises IPv4 networks IPv6 prefixes
Source address IPv4 source address IPv6 link-local address
Destination address neighbor IPv4 unicast address
224.0.0.5 all-OSPF-routers multicast address
244.0.0.6 DR/BDR multicats address
neighbor IPv6 link-local address
FF02::5 all-OSPFv3-routers multicast address
FF02::6 DR/BDR multicast address
Advertise networks network router command ipv6 ospf process-id area area-id interface configuration command
IP unicast routing Enabled by default ipv6 unicast-routing global configuration command
Authentication plaintext authentication or MD5 authentication IPv6 authentication, IPSec authentication

Troubleshooting

show ip protocols
clear ip ospf process   !This forces OSPF on R1 to transition to the Down and Init states. Required if router-id needs changing
show ip ospf neighbor   !State - The OSPF state of the interface. FULL state means that the router and its neighbor have identical OSPF LSDBs. 
                        !On multiaccess networks, such as Ethernet, two routers that are adjacent may have their states displayed as 2WAY. 
                        !The dash indicates that no DR or BDR is required because of the network type.
show ip ospf     !spf, backbone area, router-id
show ip ospf interface brief
show ip ospf interface serial 0/0/1   !cost, bandwidth


Default reference bandwidth for 100Mb/s is 10^8 100.000.000 therefore Fast Ethernet 100Mbps link cost is 1. Cost is calculated using formula:

cost = reference bandwidth bps / interface bandwidth in bps
show interface serial 0/0/1 | include BW    !verify the current bandwidth of an interface