Practical 5 Ospf
Practical 5 Ospf
5
Q5) Configuring OSPF.
OSPF Terminology
Link: Interface on a router
Link state: Description of an interface and of its relationship to its neighboring routers.
The collection of all the link-states would form a link-state database.
1.OSPF uses cost as a metric, which is the inverse of the bandwidth of a link. OSPF identifies the best
route by use of cost.
2.OSPF uses Dijkstra or SPF(Shortest Path First) algorithm. Dijkstra or SPF is a same algorithm.
4.OSPF's administrative distance is 110. (Administrative distance is the feature that routers use in
order to select the best path when there are two or more different routes to the same destination
from two different routing protocols. Administrative distance defines the reliability of a routing
protocol)
8.OSPF requires more memory and faster processors to handle OSPF than distance vector protocol.
i.e. OSPF is a CPU-intensive protocol, and very large OSPF networks can experience routing and
update traffic problems that seriously impact network performance.
10.OSPF uses WILDCARD MASK instead subnet mask.( A wildcard mask is a mask of bits that
indicates which parts of an IP address are available for examination. At a simplistic level a wildcard
mask can be thought of as an inverted subnet mask. For example, a subnet mask of 255.255.255.0
(binary equivalent = 11111111.11111111.11111111.00000000) inverts to a wildcard mask of
0.0.0.255.)
Advantages of OSPF
1. OSPF is an open-standard, purely link-state protocol.
RIP, IGRP(Interior Gateway Routing Protocol ) and EIGRP(Enhanced Interior Gateway Routing
Protocol ) are distance-vector (routing by rumor) routing protocols, susceptible to routing loops,
split-horizon, and other issues.
2. OSPF converges very quickly - from the point of recognizing a failure, it often can converge in less
than 10 seconds.
3. OSPF sends updates of only changed portion or partial updates of a network when link status
changes rather than the complete routing table. In this way, reduces the usage of bandwidth(BW)
and decreases routing overhead by sending triggered updates to announce changes in the network.
RIP and IGRP hold-down timers can cause slow convergence.
4. OSPF supports VLSM(variable length subnet masking) and CIDR. OSPF supports route
summarization. RIPv1 and IGRP do not.
6. OSPF uses the concept of areas to implement hierarchical design, not a flat design like RIP.
7. With OSPF, a router does flood its own LSAs when its age reaches 30 minutes. The flooding,
however, does not happened all at once, so the overhead is minimal. RIP sends entire routing table
every 30 seconds, IGRP every 90 seconds.
8.Link state protocol like OSPF doesn't have anything like Hop. i.e. Do not use hops to mark networks
as unreachable.
When an OSPF router does not receive a Hello packet for a specified time period, it assumes that the
neighbor is down. The router then runs the SPF algorithm to calculate new routes.
Routing Overhead
Routing overhead is the amount of information needed to describe the changes in a dynamic
network topology.
All routers in an OSPF area have identical copies of the topology database.
The topology database of one area is hidden from the rest of the areas to reduce routing overhead.
Because fewer routing updates are sent and smaller routing trees are compute
Hierarchical Design
1.Hierarchical routing speeds up the convergence time for all routers.
3.Hierarchical routing confines network instability to a single area of the network. i.e. Hierarchical
routing hides network instability from routers in other areas.
4.OSPF network can be divided into areas which is logical segmentation of a large network. OSPF
supports a two-layer hierarchical design: 1. backbone (area 0) and 2. areas off of the backbone.
Multiple OSPF areas must connect to area 0. All other areas have at least one connection to area 0,
either directly or through the use of virtual links.
If any area does not have a direct connection to the backbone area 0, then an OSPF virtual link must
be configured.
The backbone area is not a network type, but a collection of OSPF networks links. Area 0 is reserved
as the backbone area, and routers within area 0 may or may not go through the DR/BDR election
process, depending on the network type.
5.If an OSPF network is configured as a single area, then area 0 does not need to be used.
If the network design is hierarchical, then multiple areas do not need. i.e. Hierarchical OSPF network
do not require multiple areas.
6.OSPF allows to summarize networks from one area into another. Instead of routers needing to
know about all the individual networks in another area, they need to know only about the summary
route. The fewer routes result in faster convergence and less routing overhead.
7.Loopback interfaces are created on a router, and the highest IP address on a loopback (logical)
interface becomes the RID of the router but has nothing to do with areas.
8.If a network in an area go down, it will not affect routers in other areas. A small change in the
topology of a single area won't force every router to run the SPF algorithm. Changes in one area are
limited to that area only, not to every router within the entire network.
OSPF Area
5. The area number can be the range from 0 to 4,294,967,295; or 0 to 4.2 million.
6. The backbone area is not a network type, but a collection of OSPF networks links.
Area 0 is reserved as the backbone area, and routers within area 0 may or may not go through the
DR/BDR election process, depending on the network type.
7. If a network in an area goes down, it will not affect routers in other areas.
8. The OSPF command network 0.0.0.0 255.255.255.255 area 0includes all of its interfaces in area 0.
OSPF Adjacency/Neighbor
1.OSPF neighbor relationship table is called an adjacency database.
2.Before exchanging routing information, OSPF routers find out neighbors. Each router discovers its
neighbors on each interface. The list of neighbors is kept in a neighbor table.
3.Each router uses a reliable protocol to exchange topology information with its neighbors.
4.If OSPF is configured correctly, OSPF form neighbor relationships only with the routers directly
connected to it.
5.To share information with another router, they must be neighbors: their area numbers and types,
timers, and passwords must match.
To form a neighbor relationship
The following must match before routers become neighbors:
1. Hello and Dead interval must match on the two routers on the same link or they will not form
adjacency.
5. Authentication password.
OSPF Hello
1.OSPF uses Hello packets to create and maintain adjacencies. i.e. A neighbor is discovered
dynamically through reception of Hello packets.
The rules that govern the exchange of OSPF hello packets are called the Hello protocol.
6.Hello packets provide necessary information for the election of the designated router (DR) and a
backup designated router (BDR) on a LAN segment/ On multi-access networks.
7.On a broadcast multi-access and point-to-point networks, such as Ethernet, Hello packets go at
every 10 seconds.
On a non-broadcast segment, NBMA networks, such as Frame Relay, Hello packets go at every 30
seconds.
8.When an OSPF router does not receive a Hello packet for a specified time period, it assumes that
the neighbor is down. The router then runs the SPF algorithm to calculate new routes.
2.If you change the hello time, dead time will change dynamically.
3.Dead time can not be statically set.
4.The OSPF Hello time can be set with the ip ospf hello-timecommand:ip ospf hello-time 20 . As the
Dead time is 4 times the Hello time, Dead time will be 80 seconds.
5.The OSPF Dead time can be set with the ip ospf dead-timecommand:ip ospf dead-time 80 . As the
Dead time is set to 80 seconds, the Hello time will dynamically change to 20 seconds.
Cost Metric
1.A cost is associated with the output side of each router interface. This cost is configurable by the
system administrator. The lower the cost, the more likely the interface is to be used to forward data
traffic.
2.OSPF identifies the best route by use of cost. OSPF route metrics are referred to as cost.
3.OSPF uses cost as a metric, which is the inverse of the bandwidth of a link. OSPF identifies the best
route by use of cost.
For example,
Above the figure, the value 128 shown in bold is the OSPF cost metric.
4.Cost of a route is the cumulative costs of the outgoing interfaces from this router to the network.
1. Each OSPF router has an ID, which is either the highest IP address on a loopback interface, if one
exists, or the highest IP address on an active interface.
2. To configure network instability to one area of the network, OSPF uses router ID(RID) or a 32-bit
IP address selected at the beginning of the OSPF process.
3. If a router’s OSPF RID is hard coded or change a router’s OSPF RID, router reload or clear the OSPF
process is needed.
Or
Changing the OSPF RID, will require to either reload the router or clear your OSPF process.
2. Loopback address has the advantage of never going down as long as the router is powered on. It
provides greater stability the OSPF process on router and the routing table ,thus diminishing the
possibility of having to re-establish adjacencies.
5.OSPF only sends out changes when they occur. With OSPF, a router does flood its own LSAs when
it age reaches 30 minutes.
RIP sends entire routing table every 30 seconds, IGRP every 90 seconds.
Syntax7
Note
The command router ospf 100 stand for an Process ID. It is not going be advertised down stream
routers.
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf ?
<1-65535> Process ID
Router(config)#router ospf
The command router eigrp 100 stand for an Autonomous system number. Logically create group
routers with AS.
That not only will be advertised to potential neighbor, they have to agree become neighbors.
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router eigrp ?
<1-65535> Autonomous system number
Router(config)#router eigrp
Define an interface on which OSPF runs and define the area ID for that interface
Syntax
Configure loopback
Syntax
DR/BDR election
Syntax
Router(config)#interface <interface>
Router(config-if)#ip ospf priority <0-255>
R2#conf t
R2(config)# int so.123
R2(config-subif)# ip ospf priority 0
Modify bandwdth
Syntax
Router(config-if)#bandwidth kbps
Syntax
Syntax
Syntax
Enable OSPF MD5 authentication. Assign a password to be used by neighboring OSPF routers
Syntax
Verify OSPF
To see the detail information of all OSPF routing process enabled on a router
Router#show ip ospf
Syntax
___________________________________________________________________________
PRINT-OUT
___________________________________________________________________________
Configure Router R1
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.252
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#
Configure Router R2
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#int f0/0
R2(config-if)#ip add
R2(config-if)#ip address 192.168.1.2 255.255.255.252
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#
R1(config)#router ospf 1
R1(config-router)#network 192.168.1.0 0.0.0.3 area 0
R1(config-router)#^Z
R1#
Configure OSPF on router R2
R2(config)#router ospf 1
R2(config-router)#network 192.168.1.0 0.0.0.3 area 0
R2(config-router)#
00:09:35: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on FastEthernet0/0 from LOADING to FULL,
Loading Done
R1#
00:09:38: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.2 on FastEthernet0/0 from LOADING to FULL,
Loading Done
To see the default dead time on the fa0/0 interface of router R1:
R1#sh ip ospf int fa0/0
FastEthernet0/0 is up, line protocol is up
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
R1#
From the output, we see that the Hello time is 10 seconds, dead time is 40 seconds.
We want to double this Dead value using the command ip ospf dead-interval or ip osfp hello-
interval.
By default, the dead time is four times of hello times in ospf.
So, if we double the hello time, dead time will be dynamically be doubled.
Since hello time is 10 seconds on a broadcast segment, we could put 20 here.
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int fa0/0
R1(config-if)#ip ospf hello-interval 20
R1(config-if)#^Z
R1#
R1#sh ip ospf int fa0/0
Timer intervals configured, Hello 20, Dead 80, Wait 80, Retransmit 5
R1#
R2#
00:24:30: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.1.1 on FastEthernet0/0 from FULL to DOWN,
Neighbor Down: Dead timer expired
From the output, we see that the dead time is double now.
Now we have a problem with adjacency.
The adjacency went down,because we have configured hello time which effected on router R2.
To see the default dead time on the interface fa0/0 of R2 router:
Using the command ip ospf hello on R2’s fa0/0 interface to double the hello time:
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int fa0/0
R2(config-if)#ip ospf hell
R2(config-if)#ip ospf hello-interval 20
R2(config-if)#^Z
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#
STEP 1
Configure the interfaces on the R1, R2, and R3 routers with the IP addresses from the table
under the Topology Diagram.
Use the show ip interface brief command to verify that the IP addressing is
correct and that the interfaces are active.
Configure Ethernet interfaces of PC1, PC2, and PC3
Configure the Ethernet interfaces of PC1, PC2, and PC3 with the IP addresses and default
gateways from the table under the Topology Diagram.
STEP 2
Use the router ospf command in global configuration mode to enable OSPF on the
R1 router. Enter a process ID of 1 for the process-ID parameter.
R1(config)#router ospf 1
R1(config-router)#
Once you are in the Router OSPF configuration sub-mode, configure the LAN network
172.16.1.16/28 to be included in the OSPF updates that are sent out of R1.
The OSPF network command uses a combination of network-address and wildcard-mask
similar to that which can be used by EIGRP. Unlike EIGRP, the wildcard mask in OSPF is
required.
Use an area ID of 0 for the OSPF area-id parameter. 0 will be used for the OSPF area ID in all
of the network statements in this topology.
R1(config-router)#
Enable OSPF routing on the R2 router using the router ospf command.
Use a process ID of 1.
R2(config)#router ospf 1
R2(config-router)#
Configure the router to advertise the LAN network 10.10.10.0/24 in the OSPF
updates.
R2(config-router)#network 10.10.10.0 0.0.0.255 area 0
R2(config-router)#
Notice that when the network for the serial link from R1 to R2 is added to the OSPF configuration,
the router sends a notification message to the console stating that a neighbor relationship with
another OSPF router has been established.
Configure the router to advertise the 192.168.10.8/30 network attached
Configure OSPF on the R3 router using the router ospf and network
commands.
R3(config)#router ospf 1
The router ID can also be seen in the output of the show ip protocols, show ip ospf, and
show ip ospf interfaces commands.
STEP 3
On the R1 router, Use the show ip ospf neighbor command to view the
information about the OSPF neighbor routers R2 and R3. You should be able to see the
neighbor ID and IP address of each adjacent router, and the interface that R1 uses to reach that
OSPF neighbor.
R1#show ip protocols
STEP 4
R1#show ip route
R2#show ip route
R3#show ip route
STEP 5
R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
Use the show interfaces serial0/1/0 command on the R1 router to view the
bandwidth of the Serial 0/1/0 interface.
R1#show interfaces serial0/1/0
Serial0/1/0 is up, line protocol is up (connected)
Hardware is HD64570
Internet address is 192.168.10.1/30
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
On most serial links, the bandwidth metric will default to 1544 Kbits. If this is not the actual
bandwidth of the serial link, the bandwidth will need to be changed so that the OSPF cost can be
calculated correctly.
Use the bandwidth command to change the bandwidth of the serial interfaces of
the R1 ,R2, R3 routers to the actual bandwidth, 64 kbps,128 kbps and 256 kbps
R1 router:
R1(config)#interface serial0/1/0
R1(config-if)#bandwidth 64
R1(config-if)#interface serial0/1/1
R1(config-if)#bandwidth 256
R2 router:
R2(config)#interface serial0/1/0
R2(config-if)#bandwidth 256
R2(config)#interface serial0/1/1
R2(config-if)#bandwidth 128
R3 router:
R3(config)#interface serial0/1/0
R3(config-if)#bandwidth 64
R3(config)#interface serial0/1/1
R3(config-if)#bandwidth 128
Use the show ip ospf interface command on the R1 router to verify the cost
of the serial links.
The cost of the Serial links for 64kbps is now 1562, the result of the calculation: 10 8/64,000 bps
R1#show ip ospf interface
Use the ip ospf cost command to configure the OSPF cost on the R3 router.
An alternative method to using the bandwidth command is to use the ip ospf cost
command, which allows you to directly configure the cost. Use the ip ospf cost command to
change the bandwidth of the serial interfaces of the R3 router to 1562.
R3(config)#interface serial0/1/0
R3(config-if)#ip ospf cost 1562
R3(config-if)#interface serial0/1/1
R3(config-if)#ip ospf cost 1562
Use the show ip ospf interface command on the R3 router to verify that the
cost of the link the cost of each of the Serial links is now 1562.
R3#show ip ospf interface
STEP 6
Use the show ip ospf interface serial0/1/0 command to verify that the
Hello Timer and Dead Timer intervals have been modified.