OSPF (Open Shortest Path First) Part- II Topology
Figure 1 OSPF
R1 (config) #int fa0/0 R1 (config-if) #ip add 192.168.101.1 255.255.255.0 R1 (config-if) #no shut R1 (config-if) #int s0/0 R1 (config-if) #ip add 192.168.1.1 255.255.255.0 R1 (config-if) #no shut R2 (config) #int fa0/0 R2 (config-if) #ip add 192.168.102.1 255.255.255.0 R2 (config-if) #no shut R2 (config-if) #int s0/0 R2 (config-if) #ip add 192.168.1.2 255.255.255.0 R2 (config-if) #no shut R2 (config-if) #int s0/1 R2 (config-if) #ip add 192.168.2.1 255.255.255.0 R2 (config-if) #no shut
Topology
OSPF (Open Shortest Path First) Part- II R3 (config) #int fa0/0 R3 (config-if) #ip add 192.168.103.1 255.255.255.0 R3 (config-if) #no shut R3 (config-if) #int s0/0 R3 (config-if) #ip add 192.168.2.2 255.255.255.0 R3 (config-if) #no shut R3 (config-if) #int s0/1 R3 (config-if) #ip add 192.168.3.1 255.255.255.0 R3 (config-if) #no shut R4 (config) #int fa0/0 R4 (config-if) #ip add 192.168.104.1 255.255.255.0 R4 (config-if) #no shut R4 (config-if) #int s0/0 R4 (config-if) #ip add 192.168.3.2 255.255.255.0 R4 (config-if) #no shut R4 (config-if) #int s0/1 R4 (config-if) #ip add 192.168.4.1 255.255.255.0 R4 (config-if) #no shut R4 (config-if) #int s0/2 R4 (config-if) #ip add 192.168.7.1 255.255.255.0 R4 (config-if) #no shut R5 (config) #int fa0/0 R5 (config-if) #ip add 192.168.105.1 255.255.255.0 R5 (config-if) #no shut R5 (config-if) #int s0/0 R5 (config-if) #ip add 192.168.4.2 255.255.255.0 R5 (config-if) #no shut R5 (config-if) #int s0/1 R5 (config-if) #ip add 192.168.5.1 255.255.255.0 R5 (config-if) #no shut R5 (config-if) #int lo1 R5 (config-if) #ip add 170.50.1.1 255.255.255.0 R5 (config-if) #int lo2 R5 (config-if) #ip add 170.50.2.1 255.255.255.0 R5 (config-if) #int lo3 R5 (config-if) #ip add 170.50.3.1 255.255.255.0 R5 (config-if) #int lo4 R5 (config-if) #ip add 170.50.4.1 255.255.255.0 R5 (config-if) #int lo5
OSPF (Open Shortest Path First) Part- II R5 (config-if) #ip add 170.50.5.1 255.255.255.0 R6 (config) #int fa0/0 R6 (config-if) #ip add 192.168.106.1 255.255.255.0 R6 (config-if) #no shut R6 (config-if) #int s0/0 R6 (config-if) #ip add 192.168.5.2 255.255.255.0 R6 (config-if) #no shut R6 (config-if) #int s0/1 R6 (config-if) #ip add 192.168.6.1 255.255.255.0 R6 (config-if) #no shut R7 (config) #int fa0/0 R7 (config-if) #ip add 192.168.107.1 255.255.255.0 R7 (config-if) #no shut R7 (config-if) #int s0/0 R7 (config-if) #ip add 192.168.6.2 255.255.255.0 R7 (config-if) #no shut R7 (config-if) #int lo1 R7 (config-if) #ip add 170.70.1.1 255.255.255.0 R7 (config-if) #int lo2 R7 (config-if) #ip add 170.70.2.1 255.255.255.0 R7 (config-if) #int lo3 R7 (config-if) #ip add 170.70.3.1 255.255.255.0 R7 (config-if) #int lo4 R7 (config-if) #ip add 170.70.4.1 255.255.255.0 R7 (config-if) #int lo5 R7 (config-if) #ip add 170.70.5.1 255.255.255.0 R8 (config) #int fa0/0 R8 (config-if) #ip add 192.168.108.1 255.255.255.0 R8 (config-if) #no shut R8 (config-if) #int s0/0 R8 (config-if) #ip add 192.168.7.2 255.255.255.0 R8 (config-if) #no shut R8 (config-if) #int lo1 R8 (config-if) #ip add 170.80.1.1 255.255.255.0 R8 (config-if) #int lo2 R8 (config-if) #ip add 170.80.2.1 255.255.255.0 R8 (config-if) #int lo3 R8 (config-if) #ip add 170.80.3.1 255.255.255.0
OSPF (Open Shortest Path First) Part- II R8 (config-if) #int lo4 R8 (config-if) #ip add 170.80.4.1 255.255.255.0 R8 (config-if) #int lo5 R8 (config-if) #ip add 170.80.5.1 255.255.255.0
 Now we will run routing protocol on each router. R1 (config) #router ospf 100 R1 (config-router) #router-id 1.1.1.1 R1 (config-router) #int fa0/0 R1 (config-if) #ip ospf 100 area 2 R1 (config-router) #int s0/0 R1 (config-if) #ip ospf 100 area 2 R2 (config) #router ospf 100 R2 (config-router) #router-id 2.2.2.2 R2 (config-router) #int fa0/0 R2 (config-if) #ip ospf 100 area 2 R2 (config-router) #int s0/0 R2 (config-if) #ip ospf 100 area 2 R2 (config-router) #int s0/1 R2 (config-if) #ip ospf 100 area 1 R3 (config) #router ospf 100 R3 (config-router) #router-id 3.3.3.3 R3 (config-router) #int fa0/0 R3 (config-if) #ip ospf 100 area 1 R3 (config-router) #int s0/0 R3 (config-if) #ip ospf 100 area 1 R3 (config-router) #int s0/1 R3 (config-if) #ip ospf 100 area 0 R4 (config) #router ospf 100 R4 (config-router) #router-id 4.4.4.4 R4 (config-router) #int fa0/0 R4 (config-if) #ip ospf 100 area 0 R4 (config-router) #int s0/0 R4 (config-if) #ip ospf 100 area 0 R4 (config-router) #int s0/1 R4 (config-if) #ip ospf 100 area 0 R4 (config) #router ei 100 R4 (config-router) #no auto-summary
OSPF (Open Shortest Path First) Part- II R4 (config-router) #network 192.168.7.0 R5 (config) #router ospf 100 R5 (config-router) #router-id 5.5.5.5 R5 (config-router) #int fa0/0 R5 (config-if) #ip ospf 100 area 3 R5 (config-router) #int s0/0 R5 (config-if) #ip ospf 100 area 0 R5 (config-router) #int s0/1 R5 (config-if) #ip ospf 100 area 3 R5 (config-router) #int lo1 R5 (config-if) #ip ospf 100 area 3 R5 (config-router) #int lo2 R5 (config-if) #ip ospf 100 area 3 R5 (config-router) #int lo3 R5 (config-if) #ip ospf 100 area 3 R5 (config-router) #int lo4 R5 (config-if) #ip ospf 100 area 3 R5 (config-router) #int lo5 R5 (config-if) #ip ospf 100 area 3 R6 (config) #router ospf 100 R6 (config-router) #router-id 6.6.6.6 R6 (config-router) #int s0/0 R6 (config-if) #ip ospf 100 area 3 R6 (config-router) #router ei 200 R6 (config-router) #no auto-summary R6 (config-router) #network 192.168.6.0 R6 (config-router) #network 192.168.106.0 R7 (config) #router ei 200 R7 (config) #no auto-summary R7 (config) #network 0.0.0.0 R8 (config) #router ei 100 R8 (config-router) #no auto-summary R8 (config-router) #network 0.0.0.0 R1#sh ip route
OSPF (Open Shortest Path First) Part- II Here we can see only one route, because R1 is in Area 2 and it is not directly connected with area 0. Each area must be connected with area 0. Now we will create virtual link to connect area 2 with area 0.
Virtual link would be created on edge to edge router. R2 (config) #router os 100 R2 (config-router) #area 1 virtual link 3.3.3.3 R3 (config) #router os 100 R3 (config-router) #area 1 virtual link 2.2.2.2 R1#sh ip route os R1#ping 192.168.5.2 successful R1#ping 172.30.1.1 successful
OSPF creates three tables R1#sh ip os neighbor R1#sh ip os database R1#sh ip route os
Passive-Interface R1 (config) #router os 100 R1 (config-router) #passive-interface default This command will apply on each interface. R1 (config-router) #no passive-interface s0/0 If we want to make only fa0/0 passive then we need to apply only on fa0/0
R1 (config) #router os 100 R1 (config-router) #passive-interface fa0/0
OSPF Authentication R1 (config) #int s0/0 R1 (config-if) #ip ospf authentication message-digest R1 (config-if) #ip ospf message-digest key 1 md-5 Mani R1#sh ip ospf neighbor After 40 sec neighborship will be down. R1#debug ip ospf events
OSPF (Open Shortest Path First) Part- II Mismatch authentication. R1#un all R2 (config) #int s0/0 R2 (config-if) #ip ospf authentication message-digest R2 (config-if) #ip ospf message-digest key 1 md-5 Mani Neighborship will be up.
Now we will check hello & hold timers R1#sh ip ospf int s0/0 Hello – 10 sec Dead 40 sec We will change the timer R1 (config) #int s0/0 R1 (config-if) #ip ospf hello-interval 5 R1#sh ip os int s0/0 Hello 5 Dead 20 We can see if we change hello, Dead will be changed automatically. R1#sh ip os ne Neighborship will be break. In ospf hello and dead interval must match for the neighborship. R1#clear ip os process Yes
R1#debug ip os events Mismatch hello parameter R – Received C – Configured R2 (config) #int s0/0 R2 (config-if) #ip os hello-interval 5 Neighborship will be build-up Now we will change Dead interval
OSPF (Open Shortest Path First) Part- II R2 (config) #int s0/0 R2 (config-if) #ip os dead-interval 15 R2#sh ip int os s0/0 When we change dead, hello will not change automatically. R2#debug ip os events R2#un all R1 (config) #int s0/0 R1 (config-if) #ip os dead-interval 15 Neighborship will be buildup Now OSPF domain should be communicated with Eigrp 100.
For that we will perform redistribution.
R4 (config) #router os 100 R4 (config-router) #redistribute ei 100 R1#sh ip route os E2 – 192.168.108.0 E2 – 192.168.7.0 By default it would advertise classfull network. If we want to advertise classless also then we need to add a keyword “Subnets”. R4 (config) #router os 100 R4 (config-router) #redistribute ei 100 subnets R1#sh ip route os Now we can see the classless network also. 172.50.0.0. O – OSPF E2 – External (Metric type 2) Now we can see external routes metric is 20 on each route. That is not true. Default metric 20 Here internal cost should be added.
OSPF (Open Shortest Path First) Part- II R4 (config) #router os 100 R4 (config-router) #redistribute ei 100 subnets metric-type 1 Metric type 1 means add internal cost also when you exchange routes. R1#sh ip route OE – 172.30.4.0 (110/212) previously it was 20. Above we redistributed Eigrp in ospf
Now we will redistribute ospf in Eigrp R4 (config) #router ei 100 R4 (config-router) #redistribute os 100 metric 1 1 1 1 1 R1#ping 172.30.1.1 successful R1#sh ip route Here we can see two types of route, External routes and Inter area routes. There are two types of summarization 1. External Summarization (ASBR) 2. Inter Area Summarization (ABR) ASBR router is router no 4 here. R4 (config) #router os 100 R4 (config-router) #summary-address 172.80.0.0 255.255.248.0 R1#sh ip route Here we can see only one route of 172.80.0.0/21 R1#ping 172.80.1.1 R1#ping 172.80.1.1 Successful Now we will remove it. R4 (config) #router os 100 R4 (config-router) #no summary-address 172.80.0.0 255.255.248.0
Now we will summarize inter area routes. It will perform on ABR.
OSPF (Open Shortest Path First) Part- II We will summarize the network 172.50.0.0 network. For that ABR is R5. R5 (config) #router os 100 R5 (config-router) #area 3 range 172.50.0.0 255.255.248.0 R1#sh ip route os Here we can see summarized inter area routes. R1#ping 172.50.1.1 R1#ping 172.50.1.1 Successful