2018
Advanced OSPF
lab1
https://www.facebook.com/groups/1720572871550995/
for
CCNP Students
By
Eng. Abeer Hosni
1- The broadcast network configurations.
The main configurations:
R1(config)#int f0/0
R1(config-if)#ip address 10.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int loop 1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R2(config)#int f0/0
R2(config-if)#ip address 10.0.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int loop 2
R2(config-if)#ip address 2.2.2.2 255.255.255.0
The OSPF configurations:
R1(config)#router ospf 1
R1(config-router)#network 10.0.0.1 0.0.0.0 area 0
R2(config)#router ospf 2
R2(config-router)#network 10.0.0.2 0.0.0.0 area 0
Note1)
R1 and R2 will form a neighbor relationship even though the process ID is not the same.
The process ID is a locally significant number.
Note 2)
R1’s RID is 1.1.1.1, the highest loopback address even though it is not involved in
the OSPF process. And the same for R2’s RID.
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:00:39 10.0.0.2 FastEthernet0/0
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:32 10.0.0.1 FastEthernet0/0
R1(config)#router ospf 1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0
R2(config)#router ospf 2
R2(config-router)#network 2.2.2.2 0.0.0.0 area 1
R1#show ip route ospf
<Output omitted>
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/11] via 10.0.0.2, 00:01:01, FastEthernet0/0
R2#show ip route ospf
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/11] via 10.0.0.1, 00:01:31, FastEthernet0/0
Where O indicates that the route is in the same area and O IA indicates that the route is
in a different area.
Note 3)
R1 is the DR and R2 is the BDR as R1 OSPF process started first.
R1#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.0.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost:
10 Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 1.1.1.1, Interface address 10.0.0.1 Backup
Designated router (ID) 2.2.2.2, Interface address 10.0.0.2 Timer
intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
<Output omitted>
R2(config)#int f0/0
R2(config-if)#ip add 10.0.0.2 255.255.255.252
*Mar 1 00:16:52.203: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet0/0
from FULL to DOWN, Neighbor Down: Interface down or detached
R1#debug ip ospf hello
OSPF events debugging is on
*Mar 1 00:18:11.555: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 fr
om 10.0.0.1
*Mar 1 00:18:14.939: OSPF: Rcv hello from 2.2.2.2 area 0 from FastEthernet0/0 10.0.0.2
*Mar 1 00:18:14.939: OSPF: Mismatched hello parameters from 10.0.0.2
*Mar 1 00:18:14.943: OSPF: Dead R 40 C 40, Hello R 10 C 10 Mask R 255.255.255.
252 C 255.255.255.0
R1#u all
We then will fix everything again.
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:00:36 10.0.0.2 FastEthernet0/0
The second problem we will run is to change the hello interval and the dead interval which will
be configured per interface level.
R2(config)#int f0/0
R2(config-if)#ip ospf hello-interval 5
R2#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.0.2/24, Area 0
Process ID 2, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 2.2.2.2, Interface address 10.0.0.2
No backup designated router on this network
Timer intervals configured, Hello 5, Dead 20, Wait 20, Retransmit 5
<Output omitted>
R1#debug ip ospf hello
OSPF events debugging is on
*Mar 1 00:27:42.703: OSPF: Rcv hello from 2.2.2.2 area 0 from FastEthernet0/0 10.0.0.2
*Mar 1 00:27:42.703: OSPF: Mismatched hello parameters from 10.0.0.2
*Mar 1 00:27:42.707: OSPF: Dead R 20 C 40, Hello R 5 C 10 Mask R 255.255.255.0 C
255.255.255.0
R1#u all
Now again we will fix everything.
R2(config)#int f0/0
R2(config-if)#no ip ospf hello-interval 5
*Mar 1 00:29:50.963: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet0/0
from LOADING to FULL, Loading Done
To change the dead interval:
R2(config-if)#ip ospf dead-interval 40
Hint:
R1(config-if)#ip ospf dead-interval minimal hello-multiplier 3
The previous command means that the router will send 3 hello packets each second and
the dead interval will be set to 1 second. This is not recommended to configure as it will
cause a load on the router’s CPU.
The DR and BDR configurations:
R2 should be the DR as it has the highest RID, 2.2.2.2. To fix that we should reload the routers
or clear the ip OSPF process.
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R1#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.0.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 2.2.2.2, Interface address 10.0.0.2 Backup
Designated router (ID) 1.1.1.1, Interface address 10.0.0.1
<Output omitted>
The DR and BDR election is run according to the following steps.
1- The router that comes up first within 40 seconds in point-to-point and broadcast networks.
2- The router with the highest priority.
3- The router with the highest RID.
Manually configured.
interface, regardless of whether
The highest IP address assigned to a loopback
that loopback interface is OSPF-enabled.
interface on the router, regardless of
The highest IP address assigned to a physical
whether that interface is OSPF-enabled.
1- We will configure R1 to be the DR by increasing its priority.
R1(config)#int f0/0
R1(config-if)#ip ospf priority 5
R2#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R1#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.0.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 5
Designated Router (ID) 1.1.1.1, Interface address 10.0.0.1
Backup Designated router (ID) 2.2.2.2, Interface address
10.0.0.2
<Output omitted>
2- Now we will configure the default priority,
and then configure R2 to be the
DR by increasing its RID value manually.
R1(config)#int f0/0
R1(config-if)#no ip ospf priority
R2(config)#router ospf 2
R2(config-router)#router-id 3.3.3.3
Reload or use "clear ip ospf process" command, for this to take effect
R1#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R2#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R2#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.0.2/24, Area 0
Process ID 2, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 3.3.3.3, Interface address 10.0.0.2
Backup Designated router (ID) 1.1.1.1, Interface address 10.0.0.1
<Output omitted>
2- The point-to-point network configurations.
R1(config)#int s1/0
R1(config-if)#ip address 10.0.0.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#router ospf 1
R1(config-router)#network 10.0.0.1 0.0.0.0 area 0
R2(config)#int s1/1
R2(config-if)#ip address 10.0.0.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#router ospf 1
R2(config-router)#network 10.0.0.2 0.0.0.0 area 0
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.0.0.2 0 FULL/ - 00:00:29 10.0.0.2 Serial1/0
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.0.0.1 0 FULL/ - 00:00:37 10.0.0.1 Serial1/1
R1#show ip ospf int s1/0
Serial1/0 is up, line protocol is up
Internet Address 10.0.0.1/30, Area 0
Process ID 1, Router ID 10.0.0.1, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_POINT
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
<Output omitted>
Notice that there is no mention for the election of the DR or the BDR.
Using the same subnet mask is not a condition to create a neighbor
relationship in the point-to-point OSPF networks.
1- The OSPF authentication configurations.
Based on the previous topology.
R1(config)#int s1/0
R1(config-if)#ip ospf authentication ?
message-digest Use message-digest authentication
null Use no authentication
<cr>
First, using clear text authentication:
R1(config-if)#ip ospf authentication
R1(config-if)#ip ospf authentication-key CISCO
R2(config)#int s1/1
R2(config-if)#ip ospf authentication
R2(config-if)#ip ospf authentication-key CISCO
The problem with clear text authentication is that we can capture the password using any
program like wireshark.
Second, using MD5 authentication:
R1(config)#int s1/0
R1(config-if)#ip ospf authentication message-digest
R1(config-if)#ip ospf message-digest-key 1 md5 CISCO
R2#debug ip ospf adj
OSPF adjacency events debugging is on
*Mar 1 00:21:09.107: OSPF: Rcv pkt from 10.0.0.1, Serial0/0 : Mismatch Authenti
cation type. Input packet specified type 2, we use type 0
Where type 1 is the clear text authentication and type 2 is the MD5 authentication.
R2(config)#int s0/0
R2(config-if)#ip ospf authentication message-digest
R2(config-if)#ip ospf message-digest-key 1 md5 CISCO
Hint:
- OSPF authentication mode can be configured globally for all
interfaces under the OSPF process, but the authentication key still
need to be configured under the interface.
R1(config)#router ospf 1
R1(config-router)#area 0 authentication ?
message-digest Use message-digest authentication
<cr>
- OSPF v3 supports SHA authentication which is much stronger, besides
it encrypts the payload and the key.
4- The OSPF Ethernet segment configurations.
R1(config)#int f0/0
R1(config-if)#ip address 10.0.0.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#router ospf 1
R1(config-router)#network 10.0.0.1 0.0.0.0 area 0
R2(config)#int f0/0
R2(config-if)#ip address 10.0.0.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#router ospf 1
R2(config-router)#network 10.0.0.2 0.0.0.0 area 0
R3(config)#int f0/0
R3(config-if)#ip address 10.0.0.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#router ospf 1
R3(config-router)#network 10.0.0.3 0.0.0.0 area 0
R4(config)#int f0/0
R4(config-if)#ip address 10.0.0.4 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#router ospf 1
R4(config-router)#network 10.0.0.4 0.0.0.0 area 0
R1#show ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 10.0.0.1/24, Area 0
Process ID 1, Router ID 10.0.0.1, Network Type BROADCAST, Cost:
10 Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 10.0.0.1, Interface address 10.0.0.1 Backup
Designated router (ID) 10.0.0.2, Interface address 10.0.0.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
<Output omitted>
R1 is the DR as it is the router that has come up first, and R2 is the
BDR as it is the one that has come up second.
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.0.0.2 1 FULL/BDR 00:00:39 10.0.0.2 FastEthernet0/0
10.0.0.3 1 FULL/DROTHER 00:00:36 10.0.0.3 FastEthernet0/0
10.0.0.4 1 FULL/DROTHER 00:00:34 10.0.0.4 FastEthernet0/0
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.0.0.1 1 FULL/DR 00:00:32 10.0.0.1 FastEthernet0/0
10.0.0.3 1 FULL/DROTHER 00:00:33 10.0.0.3 FastEthernet0/0
10.0.0.4 1 FULL/DROTHER 00:00:31 10.0.0.4 FastEthernet0/0
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.0.0.1 1 FULL/DR 00:00:37 10.0.0.1 FastEthernet0/0
10.0.0.2 1 FULL/BDR 00:00:30 10.0.0.2 FastEthernet0/0
10.0.0.4 1 2WAY/DROTHER 00:00:35 10.0.0.4 FastEthernet0/0
R4#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
10.0.0.1 1 FULL/DR 00:00:31 10.0.0.1 FastEthernet0/0
10.0.0.2 1 FULL/BDR 00:00:34 10.0.0.2 FastEthernet0/0
10.0.0.3 1 2WAY/DROTHER 00:00:31 10.0.0.3 FastEthernet0/0
The neighbor relationship between the DRother routers will stay still at
the 2WAY state as they don’t exchange the LSA between each other’s
directly.
5- The default-information originate
Using the previous topology:
R1(config-if)#int s1/0
R1(config-if)#ip address 11.0.0.1 255.255.255.252
Suppose that R1 is the router connected to the ISP, we will configure R1 to announce itself
as a default route for each router in the OSPF network:
R1(config)#ip route 0.0.0.0 0.0.0.0 s1/0
R1(config)#router ospf 1
R1(config-router)#default-information originate
To verify:
R2#show ip route ospf
<Output omitted>
O*E2 0.0.0.0/0 [110/1] via 10.0.0.1, 00:00:21, FastEthernet0/0
R3#show ip route ospf
<Output omitted>
O*E2 0.0.0.0/0 [110/1] via 10.0.0.1, 00:01:04, FastEthernet0/0
R4#show ip route ospf
<Output omitted>
O*E2 0.0.0.0/0 [110/1] via 10.0.0.1, 00:01:27, FastEthernet0/0
But R1 must have a default route pointing to the ISP in its routing table:
R1#show ip route static
<Output omitted>
S* 0.0.0.0/0 is directly connected, Serial1/0
If we remove the default static route:
R1(config)#no ip route 0.0.0.0 0.0.0.0 s1/0
So on R2, R3 and R4 we will miss the default route.
R2#show ip route
<Output omitted>
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, FastEthernet0/0
But we can override behavior that with using the option always:
R1(config)#router ospf 1
R1(config-router)#default-information originate always
To verify:
R2#show ip route ospf
<Output omitted>
O*E2 0.0.0.0/0 [110/1] via 10.0.0.1, 00:00:06, FastEthernet0/0
R3#show ip route ospf
<Output omitted>
O*E2 0.0.0.0/0 [110/1] via 10.0.0.1, 00:00:25, FastEthernet0/0
R4#show ip route ospf
<Output omitted>
O*E2 0.0.0.0/0 [110/1] via 10.0.0.1, 00:00:36, FastEthernet0/0
6- The Cost:
OSPF Cost (metric) = 10^8/BW(bps)
For Ethernet: cost=10^8/(10*10^6)=10
For fast Ethernet: cost=10^8/(100*10^6)=1
For Giga Ethernet: cost=10^8/(1000*10^6)=1
For Serial Interfaces: cost=10^8/(1.54*10^6)=64
R1(config)#int s1/1
R1(config-if)#ip address 10.0.0.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#int s1/2
R1(config-if)#ip address 11.0.0.1 255.255.255.252
R1(config-if)#no shutdwon
R1(config-if)#router ospf 1
R1(config-router)#network 10.0.0.1 0.0.0.0 area 0
R1(config-router)#network 11.0.0.1 0.0.0.0 area 0
R2(config)#int s1/1
R2(config-if)#ip address 10.0.0.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#int f0/0
R2(config-if)#ip address 12.0.0.2 255.255.255.0
R2(config-if)#bandwidth 100000
R2(config-if)#no shutdown
R2(config-if)#int loop 2
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config-if)#router ospf 1
R2(config-router)#network 10.0.0.2 0.0.0.0 area 0
R2(config-router)#network 12.0.0.2 0.0.0.0 area 0
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0
R3(config)#int s1/2
R3(config-if)#ip address 11.0.0.2 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#int f0/0
R3(config-if)#ip address 12.0.0.3 255.255.255.0
R3(config-if)#bandwidth 100000
R3(config-if)#no shutdwon
R3(config-if)#router ospf 1
R3(config-router)#network 11.0.0.2 0.0.0.0 area 0
R3(config-router)#network 12.0.0.3 0.0.0.0 area 0
To verify:
R1#show ip route ospf
<Output omitted>
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 10.0.0.2, 00:08:29, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
O 12.0.0.0 [110/65] via 11.0.0.2, 00:04:59, Serial1/2
[110/65] via 10.0.0.2, 00:00:03, Serial1/1
Notice that the cost is cumulative. If we want to change the path that R1 uses to reach
2.2.2.2, simply we could change the cost value.
R1(config)#int s1/1
R1(config-if)#ip ospf cost 100
R1(config-if)#do show ip route ospf
<Output omitted>
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/66] via 11.0.0.2, 00:00:08, Serial1/2
12.0.0.0/24 is subnetted, 1 subnets
O 12.0.0.0 [110/65] via 11.0.0.2, 00:07:47, Serial1/2
Notice also that this will change the choice for all destinations, not only the
2.2.2.2/32 network.
Note:
By default OSPF doesn’t differentiate between Fast Ethernet and Giga Ethernet cost values:
Suppose that the organization planes to upgrade to gigabit Ethernet in the coming
months. OSPF should accurately calculate its metric assuming gigabit Ethernet will
be the fastest link in the network.
R1(config)#router ospf 1
R1(config-router)#auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
It doesn’t affect the adjacency but it’s better to run the last command on all routers in
the OSPF network.
7- Interarea Route Summarization:
We will run OSPF in area 10 using the OSPF interface command instead of the network
command:
R3(config)#int loop 0
R3(config-if)#ip address 15.0.0.3 255.255.255.0
R3(config-if)#ip ospf 1 area 10
R3(config)#int loop 1
R3(config-if)#ip address 15.1.0.3 255.255.255.0
R3(config-if)#ip ospf 1 area 10
R3(config)#int loop 2
R3(config-if)#ip address 15.2.0.3 255.255.255.0
R3(config-if)#ip ospf 1 area 10
R3(config)#int loop 3
R3(config-if)#ip address 15.3.0.3 255.255.255.0
R3(config-if)#ip ospf 1 area 10
To verify:
R2#show ip route ospf
<Output omitted>
11.0.0.0/30 is subnetted, 1 subnets
O 11.0.0.0 [110/65] via 12.0.0.3, 00:05:19, FastEthernet0/0
15.0.0.0/32 is subnetted, 4 subnets
O IA 15.0.0.3 [110/2] via 12.0.0.3, 00:02:27, FastEthernet0/0
O IA 15.1.0.3 [110/2] via 12.0.0.3, 00:01:47, FastEthernet0/0
O IA 15.2.0.3 [110/2] via 12.0.0.3, 00:01:37, FastEthernet0/0
O IA 15.3.0.3 [110/2] via 12.0.0.3, 00:01:17, FastEthernet0/0
Now we need to summarize these networks to minimize the routing table:
15.0.0.0 00001111.00000000.00000000.00000000
15.1.0.0 00001111.00000001.00000000.00000000
15.2.0.0 00001111.00000010.00000000.00000000
15.3.0.0 00001111.00000011.00000000.00000000
So these networks would be summarized as 15.0.0.0/14 with subnet mask of 255.252.0.0
R3(config)#router ospf 1
R3(config-router)#area 10 range 15.0.0.0 255.252.0.0
To verify:
R2#show ip route ospf
<Output omitted>
11.0.0.0/30 is subnetted, 1 subnets
O 11.0.0.0 [110/65] via 12.0.0.3, 00:09:59, FastEthernet0/0
15.0.0.0/14 is subnetted, 1 subnets
O IA 15.0.0.0 [110/2] via 12.0.0.3, 00:00:22, FastEthernet0/0
And the network should be still pingable.
Note:
The passive-interface command prevents routing updates from being sent through the
specified router interface. This is commonly done to reduce traffic on the LANs as they do
not need to receive dynamic routing protocol communication.
R1(config)# router ospf 1
R1(config-router)# passive-interface f0/0
R1# show ip ospf interface f0/0
No Hellos (Passive interface)
If you want to Set passive interface as the default on a router:
R1(config)#router ospf 1
R1(config-router)#passive-interface default
R1(config-router)#no passive-interface int s1/1
Best Wishes
Abeer