5. Implementing Basic OSPF
5.1 Core OSPF Configuration
5.2 Objectives
1. Configure OSPF for the above network diagram. R1 will act as an ASBR by by redistributing a
series of static routes into the OSPF network. These routes should NOT increment their metric
as they pass through the network and should have an initial OSPF cost of 200. All routers
have a router-id reflecting their hostname; you should be able to ping this router-id
throughout the entire OSPF network.
R1
R1#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 unassigned YES unset administratively down down
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
R1(config)#int fa0/0
R1(config-if)#ip address 172.30.0.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#no shut
R1(config)#router ospf 1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R1(config-router)#network 172.30.0.1 0.0.0.0 area 0
R1(config-router)#router-id 1.1.1.1
R1(config-router)#end
R1#
R1#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.30.0.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 unassigned YES unset administratively down down
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
Loopback0 1.1.1.1 YES manual up up
.
.
.
.
.
R2
R2#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 unassigned YES unset administratively down down
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
R2(config)#int fa0/0
R2(config-if)#ip address 172.30.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int lo0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s2/0
R2(config-if)#ip address 172.30.10.2 255.255.255.0
R2(config-if)#no shut
R2(config)#router os 1
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R2(config-router)#network 172.30.0.2 0.0.0.0 area 0
R2(config-router)#network 172.30.10.2 0.0.0.0 area 10
R2(config-router)#router-id 2.2.2.2
R2(config-router)#end
R2#
R2#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.30.0.2 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 172.30.10.2 YES manual up up
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
Loopback0 2.2.2.2 YES manual up up
R3
R3#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 unassigned YES unset administratively down down
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
R3(config)#int fa0/0
R3(config-if)#ip address 172.30.0.3 255.255.255.0
R3(config-if)#no shut
R3(config-router)#int s2/0
R3(config-if)#ip address 172.30.20.3 255.255.255.0
R3(config-if)#no shut
R3(config-router)#int lo0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#no shut
R3(config)#router os 1
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0
R3(config-router)#network 172.30.0.3 0.0.0.0 area 0
R3(config-router)#network 172.30.20.3 0.0.0.0 area 20
R3(config-router)#router-id 3.3.3.3
R3(config-router)#end
R3#
R3#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.30.0.3 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 172.30.20.3 YES manual up down
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
Loopback0 3.3.3.3 YES manual up up
R4
R4#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 unassigned YES unset administratively down down
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
R4(config)#int s2/0
R4(config-if)#ip address 172.30.20.4 255.255.255.0
R4(config-if)#no shut
R4(config)#int lo0
R4(config-if)#ip address 4.4.4.4 255.255.255.0
R4(config-if)#no shut
R4(config)#router os 1
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0
R4(config-router)#network 172.30.20.4 0.0.0.0 area 20
R4(config-router)#router-id 4.4.4.4
R4(config-router)#end
R4#
R4#
R4#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 172.30.20.4 YES manual up up
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
Loopback0 4.4.4.4 YES manual up up
.
.
.
.
.
R5
R5#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 unassigned YES unset administratively down down
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
Loopback0 unassigned YES unset administratively down down
R5(config)#int s2/0
R5(config-if)#ip address 172.30.10.5 255.255.255.0
R5(config-if)#no shut
R5(config)#int lo0
R5(config-if)#ip address 5.5.5.5 255.255.255.0
R5(config-if)#no shut
R5(config-if)#router os 1
R5(config-router)#network 5.5.5.5 0.0.0.0 area 10
R5(config-router)#network 172.30.10.5 0.0.0.0 area 10
R5(config-router)#router-id 5.5.5.5
R5(config-router)#end
R5#
R5#sh ip int brie
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
FastEthernet1/1 unassigned YES unset administratively down down
Serial2/0 172.30.10.5 YES manual up up
Serial2/1 unassigned YES unset administratively down down
Serial2/2 unassigned YES unset administratively down down
Serial2/3 unassigned YES unset administratively down down
Serial2/4 unassigned YES unset administratively down down
Serial2/5 unassigned YES unset administratively down down
Serial2/6 unassigned YES unset administratively down down
Serial2/7 unassigned YES unset administratively down down
Loopback0 5.5.5.5 YES manual up up
Summary
1. It’s very helpful to make a design draft and to have a overview, where the area boundaries are.
2. Configure the Loopback addresses and as well the physical interfaces. Always keep in mind, which interface depends to which area.
3. To get a quick survey, use the show command ‘sh ip int brief’. So you can verifying, which port are in use and which interface are up/up or down/down state.
4. With the show command ‘sh ip ospf neighbor’ you can see in a shared environment which is the DR and the BDR. I added a Router R6 to the area 0 to show, how the output fo the command looked like.
Output R2 'show ip ospf neighbor'
R2#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:37 172.30.0.1 FastEthernet0/0
3.3.3.3 1 2WAY/DROTHER 00:00:35 172.30.0.3 FastEthernet0/0
6.6.6.6 1 FULL/BDR 00:00:33 172.30.0.4 FastEthernet0/0
5.5.5.5 0 FULL/ – 00:00:34 172.30.10.5 Serial2/0
5. From the point of view from R2, R1 are the FULL/DR and R6 are the FULL/BDR. R5 are directly connected. It is not a shared environment. R2 has a neighbor adjacency to R5 with a point-to-point connection. So the output is FULL/-.
Output R1 ‘show ip ospf neighbor’
R1#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DROTHER 00:00:31 172.30.0.2 FastEthernet0/0
3.3.3.3 1 FULL/DROTHER 00:00:32 172.30.0.3 FastEthernet0/0
6.6.6.6 1 FULL/BDR 00:00:39 172.30.0.4 FastEthernet0/0
6. From the point of view from R1, R2 has formed a neighbor adjaceny to R2 with the output FULL/DROTHER.
Because R1 is the DR and R2 is not the BDR.
.
.
.
5.3 Redistribute the statics
E1 increment their metric. That means cost of 200 + 10 + 100 for example.
E2 doesn’t increment their metric.
R1(config-router)#redistribute static subnets metric 200 metric-type ?
1 Set OSPF External Type 1 metrics
2 Set OSPF External Type 2 metrics
R1(config-router)#redistribute static subnets metric 200 metric-type 2
Redistribute the statics
R1(config)#ip route 172.16.0.0 255.255.255.0 Null0
R1(config)#ip route 172.16.1.0 255.255.255.0 Null0
R1(config)#ip route 172.16.2.0 255.255.255.0 Null0
R1(config)#ip route 172.16.3.0 255.255.255.0 Null0
R1(config-router)#redistribute static subnets metric 200 metric-type 2
Verification on R5
R5#sh ip route os
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/66] via 172.30.10.2, 01:19:03, Serial2/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/65] via 172.30.10.2, 01:19:03, Serial2/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/66] via 172.30.10.2, 01:18:35, Serial2/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/130] via 172.30.10.2, 01:18:35, Serial2/0
6.0.0.0/32 is subnetted, 1 subnets
O IA 6.6.6.6 [110/66] via 172.30.10.2, 01:19:03, Serial2/0
172.16.0.0/24 is subnetted, 4 subnets
O E2 172.16.0.0 [110/200] via 172.30.10.2, 00:00:02, Serial2/0
O E2 172.16.1.0 [110/200] via 172.30.10.2, 00:00:02, Serial2/0
O E2 172.16.2.0 [110/200] via 172.30.10.2, 00:00:02, Serial2/0
O E2 172.16.3.0 [110/200] via 172.30.10.2, 00:00:02, Serial2/0
172.30.0.0/24 is subnetted, 3 subnets
O IA 172.30.20.0 [110/129] via 172.30.10.2, 01:18:35, Serial2/0
O IA 172.30.0.0 [110/65] via 172.30.10.2, 01:19:03, Serial2/0
On R5 you can see the InterArea routes for example for R6 with
show ip route ospf
O IA 6.6.6.6 [110/66] via 172.30.10.2, 01:19:03, Serial2/0
and also see the external static routes on R5
O E2 172.16.0.0 [110/200] via 172.30.10.2, 00:00:02, Serial2/0
O E2 172.16.1.0 [110/200] via 172.30.10.2, 00:00:02, Serial2/0
O E2 172.16.2.0 [110/200] via 172.30.10.2, 00:00:02, Serial2/0
O E2 172.16.3.0 [110/200] via 172.30.10.2, 00:00:02, Serial2/0
The metric for E2 will be always the same = 200 (no increment)
perfect. we can go ahead !
5.4 Configuring the loopback adresses on R4 and R5
R4 and R5
On R5#
conf t
int lo1
ip add 10.10.0.1 255.255.255.0
no shut
int lo2
ip add 10.10.1.1 255.255.255.0
no shut
int lo3
ip add 10.10.2.1 255.255.255.0
no shut
int lo4
ip add 10.10.3.1 255.255.255.0
no shut
On R4#
conf t
int lo1
ip add 10.20.0.1 255.255.255.0
no shut
int lo2
ip add 10.20.1.1 255.255.255.0
no shut
int lo3
ip add 10.20.2.1 255.255.255.0
no shut
int lo4
ip add 10.20.3.1 255.255.255.0
no shut
5.5 Network Statement
On R4 do a ‘show ip route’ end press enter.
you can see that the loopback addresses from R5 are shown with a 32bit mask.
a network statement must be forcefully dedicated to an physical interface
wrong: network 172.30.0.0 0.0.0.0 area 0
right: network 172.30.0.1 0.0.0.0 area 0
network statement
Output from R4#
10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
O IA 10.10.1.1/32 [110/130] via 172.30.20.3, 00:00:03, Serial2/0
O IA 10.10.0.1/32 [110/130] via 172.30.20.3, 00:07:41, Serial2/0
O IA 10.10.3.1/32 [110/130] via 172.30.20.3, 00:07:41, Serial2/0
O IA 10.10.2.1/32 [110/130] via 172.30.20.3, 00:07:41, Serial2/0
C 10.20.2.0/24 is directly connected, Loopback3
C 10.20.3.0/24 is directly connected, Loopback4
On R5 type in following command on loopback address 3
conf t
int lo3
ip ospf network point-to-point
Output from R4#
10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
O IA 10.10.1.0/24 [110/130] via 172.30.20.3, 00:00:02, Serial2/0
O IA 10.10.0.1/32 [110/130] via 172.30.20.3, 00:10:02, Serial2/0
O IA 10.10.3.1/32 [110/130] via 172.30.20.3, 00:10:02, Serial2/0
O IA 10.10.2.1/32 [110/130] via 172.30.20.3, 00:10:02, Serial2/0
With this command the routes will commited as a network. Not as a host address.
5.6 Route summarization on ABR and ASBR
route summarization
on ABR (R2)
R2(config-router)#area 10 range 10.10.0.0 255.255.252.0
on ASBR (R1)
R1(config-router)#summary-address 172.16.0.0 255.255.252.0
Output on R2#
10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
O 10.10.1.1/32 [110/65] via 172.30.10.5, 00:01:37, Serial2/0
O 10.10.0.0/22 is a summary, 00:01:37, Null0
O 10.10.0.1/32 [110/65] via 172.30.10.5, 00:01:37, Serial2/0
O 10.10.3.1/32 [110/65] via 172.30.10.5, 00:01:37, Serial2/0
O 10.10.2.1/32 [110/65] via 172.30.10.5, 00:01:37, Serial2/0
Output on R1#
172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks
S 172.16.0.0/24 is directly connected, Null0
O 172.16.0.0/22 is a summary, 00:00:07, Null0
S 172.16.1.0/24 is directly connected, Null0
S 172.16.2.0/24 is directly connected, Null0
S 172.16.3.0/24 is directly connected, Null0
5.7 auto-cost command
If you want adjust your auto-costs, you can type in the following command.
If 1 Gbit/s is your fastest line in your environment, go to the router process and type in the auto-cost command.
R2(config-router)#auto-cost reference-bandwidth ?
<1-4294967> The reference bandwidth in terms of Mbits per second
R2(config-router)#auto-cost reference-bandwidth 1000
But you have to do this for all your routers in your areas and environment.
Be carefully with this command and do not use a to high number of auto-cost. Maximum possible value is 4294967. But you run the risk, that lower
bandwidth lines ar never been calculated and drop out of the ospf process.
5.8 Interface priority command
Each broadcast and Non-Broadcast Multi-Access (NBMA) network has a designated router. If the network is a transit network, the designated
router generates a link state advertisement (LSA) for the network and has other responsibilities required for the running of the protocol. The
designated router is elected by the Hello Protocol.
The designated router concept reduces the amount of routing protocol traffic and reduces the size of the link-state database by enabling a
reduction in the number of adjacencies required on a broadcast or non-broadcast multi-access network.
When two routers attached to a network both attempt to become the designated router, the router with the highest priority becomes the
designated router. A router whose priority is set to 0 is ineligible to become designated router or backup designated router.
Use the ip ospf priority [1 – 255] command to set the priority to a value between 1 and 255.
Use the ip ospf priority 0 command to configure the router to never function as the designated router or backup designated router.
Use the no ip ospf priority command to set the priority at the default value of 1.
Factory Default: 1.
Command Mode: Interface configuration.
5.9 Tie break for the Router ID
1. Router ID is the router name
2. Highest active Interface IP Adress when ospf starts.
3. Loopback beat physical Interfaces.
4. Router-ID command
5. Priority (the higher wins)
If the priority not handled in the right way, clear the ospf process
Router# clear ip ospf process
Reset ALL OSPF process? [no]:
conform with yes