:::: MENU ::::

Friday, June 17, 2022

OSPF stands for Open Shortest Path First. OSPFv2 is used along with IPv4 network layer protocol. But OSPFv3 is for IPv6.
It is developed as an alternative distance vector algorithm (routing information protocol. abbreviation- RIP).
Lets make clear concept about link state: Every router has multiple interfaces and each interface acts of a network segment and each of them is called a link of network. Network segment could be stub network, connected two routers etc. So Link-State refers the information of the state of link. A link-state info could have the network prefix, prefix length, and cost etc.
OSPF protocol can be summarize into three components. 
They are 
1. Routing protocol messages: They are five types. 
2. Constructing data structures: they are three types; Each of them has special significance. They are 
a. adjacency database:
It keeps information about its neighbors e.g. a router has 3 interfaces connected with other routers, so it has 3 neighors. this database will be unique for each router.
b. Link-state database: 
Most important table it is. This database has complete struture of topology. E.g. suppose a router belongs to an area 0 in which somehow total 5 routers are connected with each others and they could be in star topology, mesh topology etc. So all router belong to same topology must have identical LSDB.
c. Forwarding database: 
It keeps routes generated by running routing algorithms (Shortest path first)
3. Applied algorithm: Dijkstra Shortest path first.
routing protocol messages:
Routers running OSPF exchange messages to convey routing information using five types of packets. These packets, as shown in the figure, are as follows:

1. Hello packet
Discovering neighbour routers.
2. Database description packet (DBD). 
Note that it means exchaning LSDB/ topology table to other routers. It is necessary, to make sure the LSDB is identical on every router in the area.
3. Link-state request packet (LSR)
Note that, it is used by a router when a router needs specific info about an entry of link state table.
4. Link-state update packet (LSU)
it is actually a response of request of LSR.
5. Link-state acknowledgment packet
it is an acknowledgment of receivng response packet (LSU).

Most generic processes that a router go through to build its routing table are:
1. collect neighbouring info and build neighbour table using Hello protocol packet.
2. exchange neighbour table-info other router; its called exchaning link state advertisements (LSAs) and LSUs contains LSAs.
3. establishing link state database
4. execute SPF (Shortest Path First) algorithm
5. build routing table


OSPF configuration
1. enable OSPFv2 on router
command: (config)# router ospf <process id>
Note for process id:
The process-id value represents a number between 1 and 65,535 and is selected by the network administrator. The process-id value is locally significant, which means that it does not have to be the same value on the other OSPF routers to establish adjacencies with those neighbors. It is considered best practice to use the same process-id on all OSPF routers.
Some important terms:
Router id:
It is represented as IPv4 address. The router ID is used to uniquely identify an OSPF router. All OSPF packets exchanged among other routers have the router ID of the originating router. Every router requires a router ID to participate in an OSPF domain. The router ID can be defined by an administrator or automatically assigned by the router.
So, adminstrator could have good control on network, if the router id is configured in the recommanded ways.
there are three available ways:
1. explicitly configure the router id through command. It is highly recommanded way.
(config-router)# router-id <rid>
2. Secondly if it's not configured in explicit way, router tries to choose configured highest IPv4 loopback address.
(config)#interface loopback 1
(config-if)# ip address 1.1.1.1 255.255.255.255
(config-if)# end
justifying:
R1# show ip protocols | include Router ID
Expected output: Router ID 1.1.1.1

3. Lastly, router uses highest IPv4 address from active IPv4 interface's addresses.


OSPF configuration on networks:
There are two types of networks: point-to-point and multiaccess network.
OSPF can be enabled on router using Network command.
(config-router)# network <network-address> <wildcard-address> area <area-id>
alternative process is:
(config-router)# network <direct interface address> <quad zero> area <area-id>
The advantages of this command is no need to calculate wildcard address from subnet mask.
Another alternative process is:
(config-if)# ip ospf <process-id> area <area-id>
(when an interface or a router is activated as OSPF router. All OSPF interface sends out hello packet and by default they are supposed to be in multiaccess network.
so to make an interface as point-to-point network the following command is applied on that interface:
(config-if)# ip ospf network point-to-point
Note:
1. The network-address wildcard-mask syntax is used to enable OSPF on interfaces. Any interfaces on a router that match the network address in the network command are enabled to send and receive OSPF packets.
    2.The area area-id syntax refers to the OSPF area. When configuring single-area OSPFv2, the network command must be configured with the same area-id value on all routers. Although any area ID can be used, it is good practice to use an area ID of 0 with single-area OSPFv2. This convention makes it easier if the network is later altered to support multiarea OSPFv2.
OSPF in Multi-Access Network:
One important difference apart from point-to-point network is DR controls the distribution of LSAs. DR uses multicast address 224.0.0.5 for distribution and 224.0.0.6 multicast address is used for listening from DROTHER routers. Because DROTHERs use the multiaccess address 224.0.0.6 (all designated routers) to send OSPF packets to the DR and BDR.
In brief the role of DR is:
Only the DR and the BDR process the LSA sent by DROTHER router using the multicast IPv4 address 224.0.0.6. The DR then sends out the LSA to all OSPF routers using the multicast IPv4 address 224.0.0.5.
(Ethernet LANs are the most common example of broadcast multiaccess networks.)
verifying interface ospf state:
# show ip ospf interface <interface name>
It shows neighbor list of router:
#show ip ospf neighbor 
OSPF DR and BDR elections are not pre-emptive. If a new router with a higher priority or higher router ID is added to the network after the DR and BDR election, the newly added router does not take over the DR or the BDR role. This is because those roles have already been assigned. The addition of a new router does not initiate a new election process.
Router(config-router)# auto-cost reference-bandwidth Mbps
ip ospf cost 
Verification:
# show ip ospf
Verify the OSPF process
# show ip ospf neighbor
to display neighbor adjacencies.
# show ip protocols
# show ip ospf interface brief
# show ip ospf interface <interface name>
# show ip route ospf

0 comments:

Post a Comment