Monday 12 March 2012

IMPLEMENTING BASIC OSPF






Core OSPF Configuration
Route Summarisation
DR Election
OSPF cost calculation





OBJECTIVE 1

Configure OSPF for the above network diagram. R1 will act as an ASBR 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 should have a router-id reflecting their hostname; you should be able to ping this router-id throughout the entire OSPF network.





Lets start off with Router1 and get OSPF up and running (I have already configured the basic networking)


R1(config)#router ospf 1
R1(config-router)#network 172.30.0.1 0.0.0.0 area 0
R1(config-router)#router-id 1.1.1.1

As mentioned before, it is worth while specifying the router-id now, rather than after the OSPF neighbourship as once it has formed you would have to clear the OSPF process or reboot the router(s) - by default it would of chosen the loopback interface as the RID

Lets setup the redistribution of the static routes into OSPF

R1(config-router)#redistribute static subnets


DONT forget the metric ...

R1(config-router)#redistribute static subnets metric ?
  <0-16777214>  OSPF default metric


We also need to specify the seed metric that these routes will start off with (looking at the objective it is 200)

and they must not increment when prograting thru the network (remember this from EIGRP/OSPF redistributition ...)

By default they are E2 routes which do not increment, E1 routes doo incriment

WHY AND WHEN TO USE WHICH METRIC-TYPE
Since our ASBR is the only exit point for these OSPF routes ... it doesnt matter which way the routers go to get to it, So their is no point the routers taking CPU cycles doing all the math, however if we had another exit point for them, then we would want the intelligence in the route decisions and we would use E1 routes



R1(config-router)#redistribute static subnets metric 200



Lets get our neighbours up and running ..

R2(config)#router ospf 1
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

*Mar  1 00:50:53.083: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done


R2#show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:39    172.30.0.1      FastEthernet0/0




Lets check R1;

R1#show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
172.30.10.2       1   FULL/BDR        00:00:33    172.30.0.2      FastEthernet0/0


Ah, yes notice the RID, lets try and change it:

R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
Reload or use "clear ip ospf process" command, for this to take effect


Soooo...

R2#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R2#y
*Mar  1 01:01:06.835: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached


R1#show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           1   FULL/BDR        00:00:38    172.30.0.2      FastEthernet0/0


and lets check for that route from area 10;

R1#show ip route

     172.16.0.0/24 is subnetted, 4 subnets
S       172.16.0.0 is directly connected, Null0
S       172.16.1.0 is directly connected, Null0
S       172.16.2.0 is directly connected, Null0
S       172.16.3.0 is directly connected, Null0
     172.30.0.0/24 is subnetted, 2 subnets
C       172.30.0.0 is directly connected, FastEthernet0/0
O IA    172.30.10.0 [110/210] via 172.30.0.2, 00:00:30, FastEthernet0/0



Also R2 has got the static routes with their new cost of 200 (and notice the E2 flag);

R2#show ip route
     172.16.0.0/24 is subnetted, 4 subnets
O E2    172.16.0.0 [110/200] via 172.30.0.1, 00:00:09, FastEthernet0/0
O E2    172.16.1.0 [110/200] via 172.30.0.1, 00:00:09, FastEthernet0/0
O E2    172.16.2.0 [110/200] via 172.30.0.1, 00:00:09, FastEthernet0/0
O E2    172.16.3.0 [110/200] via 172.30.0.1, 00:00:09, FastEthernet0/0
     172.30.0.0/24 is subnetted, 2 subnets
C       172.30.0.0 is directly connected, FastEthernet0/0
C       172.30.10.0 is directly connected, Serial0/0


 Lets do R3;

R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 172.30.0.3 0.0.0.0 area 0
R3(config-router)#
*Mar  1 01:10:19.827: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R3(config-router)#
*Mar  1 01:10:25.883: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
R3(config-router)#network 172.30.20.3 0.0.0.0 area 20


Lets check his router table:


R3#show ip route

     172.16.0.0/24 is subnetted, 4 subnets
O E2    172.16.0.0 [110/200] via 172.30.0.1, 00:01:36, FastEthernet0/0
O E2    172.16.1.0 [110/200] via 172.30.0.1, 00:01:36, FastEthernet0/0
O E2    172.16.2.0 [110/200] via 172.30.0.1, 00:01:36, FastEthernet0/0
O E2    172.16.3.0 [110/200] via 172.30.0.1, 00:01:36, FastEthernet0/0
     172.30.0.0/24 is subnetted, 3 subnets
C       172.30.20.0 is directly connected, Serial0/0
C       172.30.0.0 is directly connected, FastEthernet0/0
O IA    172.30.10.0 [110/210] via 172.30.0.2, 00:01:37, FastEthernet0/0




lets do R4

R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 10.0.0.0 0.255.255.255 area 20
R4(config-router)#network 172.30.20.4 0.0.0.0 area 20
R4(config-router)#
*Mar  1 01:16:29.455: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on Serial0/0 from LOADING to FULL, Loading Done
R4(config-router)#


R4#show ip route

     172.16.0.0/24 is subnetted, 4 subnets
O E2    172.16.0.0 [110/200] via 172.30.20.3, 00:00:40, Serial0/0
O E2    172.16.1.0 [110/200] via 172.30.20.3, 00:00:40, Serial0/0
O E2    172.16.2.0 [110/200] via 172.30.20.3, 00:00:40, Serial0/0
O E2    172.16.3.0 [110/200] via 172.30.20.3, 00:00:40, Serial0/0
     172.30.0.0/24 is subnetted, 3 subnets
C       172.30.20.0 is directly connected, Serial0/0
O IA    172.30.0.0 [110/210] via 172.30.20.3, 00:00:40, Serial0/0    (Area 0)
O IA    172.30.10.0 [110/410] via 172.30.20.3, 00:00:42, Serial0/0  (Area 10)
     10.0.0.0/24 is subnetted, 4 subnets
C       10.20.2.0 is directly connected, Loopback3
C       10.20.3.0 is directly connected, Loopback4
C       10.20.0.0 is directly connected, Loopback1
C       10.20.1.0 is directly connected, Loopback2



and R5;
R5(config)#router ospf 1
R5(config-router)#router-id 5.5.5.5
R5(config-router)#network 172.30.10.5 0.0.0.0 area 10
R5(config-router)#network 10.10.0.0 0.0.255.255 area 10



We now have our new neighbour up and running;

R5#show ip route

     172.16.0.0/24 is subnetted, 4 subnets
O E2    172.16.0.0 [110/200] via 172.30.10.2, 00:07:25, Serial0/0
O E2    172.16.1.0 [110/200] via 172.30.10.2, 00:07:25, Serial0/0
O E2    172.16.2.0 [110/200] via 172.30.10.2, 00:07:25, Serial0/0
O E2    172.16.3.0 [110/200] via 172.30.10.2, 00:07:25, Serial0/0
     172.30.0.0/24 is subnetted, 3 subnets
O IA    172.30.20.0 [110/410] via 172.30.10.2, 00:07:25, Serial0/0
O IA    172.30.0.0 [110/210] via 172.30.10.2, 00:07:25, Serial0/0
C       172.30.10.0 is directly connected, Serial0/0
     10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
C       10.10.0.0/24 is directly connected, Loopback1
C       10.10.1.0/24 is directly connected, Loopback2
C       10.10.2.0/24 is directly connected, Loopback3
C       10.10.3.0/24 is directly connected, Loopback4
O IA    10.20.3.1/32 [110/411] via 172.30.10.2, 00:07:28, Serial0/0
O IA    10.20.2.1/32 [110/411] via 172.30.10.2, 00:07:28, Serial0/0
O IA    10.20.1.1/32 [110/411] via 172.30.10.2, 00:07:28, Serial0/0
O IA    10.20.0.1/32 [110/411] via 172.30.10.2, 00:07:28, Serial0/0




Although, in the normal working world having them loopbacks advertised as /32 is normal (even though i have configured them as a /24, OSPF is clever enough to not get fooled and shows it as the 1 address, but since we are in a lab enviroment we can tweak it, as i have shown you before to look like a /24 network)

R5(config)#int loo 1
R5(config-if)#ip ospf network point-to-point
R5(config)#inte loo 2
R5(config-if)#ip ospf network point-to-point
R5(config-if)#inte loo 3
R5(config-if)#ip ospf network point-to-point
R5(config-if)#inte loo 4
R5(config-if)#ip ospf network point-to-point


R4(config)#int loo 1
R4(config-if)#ip ospf network point-to-point
R4(config-if)#int loo 2
R4(config-if)#ip ospf network point-to-point
R4(config-if)#int loo 3
R4(config-if)#ip ospf network point-to-point
R4(config-if)#int loo 4
R4(config-if)#ip ospf network point-to-point




R1#show ip route


     172.16.0.0/24 is subnetted, 4 subnets
S       172.16.0.0 is directly connected, Null0
S       172.16.1.0 is directly connected, Null0
S       172.16.2.0 is directly connected, Null0
S       172.16.3.0 is directly connected, Null0
     172.30.0.0/24 is subnetted, 3 subnets
O IA    172.30.20.0 [110/210] via 172.30.0.3, 00:23:05, FastEthernet0/0
C       172.30.0.0 is directly connected, FastEthernet0/0
O IA    172.30.10.0 [110/210] via 172.30.0.2, 00:23:05, FastEthernet0/0
     10.0.0.0/24 is subnetted, 8 subnets
O IA    10.10.0.0 [110/211] via 172.30.0.2, 00:07:09, FastEthernet0/0
O IA    10.10.1.0 [110/211] via 172.30.0.2, 00:04:38, FastEthernet0/0
O IA    10.10.2.0 [110/211] via 172.30.0.2, 00:04:28, FastEthernet0/0
O IA    10.10.3.0 [110/211] via 172.30.0.2, 00:04:29, FastEthernet0/0
O IA    10.20.2.0 [110/211] via 172.30.0.3, 00:02:06, FastEthernet0/0
O IA    10.20.3.0 [110/211] via 172.30.0.3, 00:02:06, FastEthernet0/0
O IA    10.20.0.0 [110/211] via 172.30.0.3, 00:02:16, FastEthernet0/0
O IA    10.20.1.0 [110/211] via 172.30.0.3, 00:02:16, FastEthernet0/0



THATS BETTER :0) ... okay thats STEP 1 COMPLETE




OBJECTIVE 2.

After completing the initial step of the lab, one of the routers in Area 0 will become the DR and one will become the BDR for the Ethernet segment. Which router will become the DR and BDR? Write DR and BDR next to the respective router below.
o R1
o R2
o R3

Well, lets just reset the process as currently the order i booted these bad bois will affect the results, so..


R1#clear ip ospf process
Reset ALL OSPF processes? [no]: y
R1#
*Mar  1 00:35:35.159: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar  1 00:35:35.163: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Mar  1 00:35:35.347: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
*Mar  1 00:35:35.351: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done

Lets have a look and see what we have:

R1#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
  Internet Address 172.30.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 DROTHER, Priority 1
  Designated Router (ID) 3.3.3.3, Interface address 172.30.0.3
  Backup Designated router (ID) 2.2.2.2, Interface address 172.30.0.2
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:02
  Supports Link-local Signaling (LLS)
  Index 1/1, flood queue length 0
  Next 0x0(0)/0x0(0)
  Last flood scan length is 2, maximum is 4
  Last flood scan time is 0 msec, maximum is 4 msec
  Neighbor Count is 2, Adjacent neighbor count is 2
    Adjacent with neighbor 2.2.2.2  (Backup Designated Router)
    Adjacent with neighbor 3.3.3.3  (Designated Router)
  Suppress hello for 0 neighbor(s)



If we look on R2 we can see that he sees R1 as a DROTHER


R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DROTHER    00:00:32    172.30.0.1      FastEthernet0/0
3.3.3.3           1   FULL/DR         00:00:33    172.30.0.3      FastEthernet0/0
5.5.5.5           0   FULL/  -        00:00:38    172.30.10.5     Serial0/0
R2#



So in answer to the question;
o R1
o R2 BDR
o R3 DR

So,  WHY and how do we have the results we do, WELL .....
OSPF can use the interface OSPF priority to influence the selection, but by default everything has a priority of 1;

R1#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
  Internet Address 172.30.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 DROTHER, Priority 1

The next thing to break the tie is the highest loopback interface, which in our case was router 3, however if R3 were to be unavailable (turned off) then R2 would of been the DR and so on ...



OBJECTIVE 3.

Ensure R1 becomes the DR on the Ethernet segment in Area 0. R2 and R3 should not become a DR or BDR for the Ethernet segment in Area 0. After this change is made, what type of neighbor relationship should exist between R1 and R2? What about R2 and R3?

So looking at the output below, FA0/1 is attached the ethernet segment 172.30.0.1/24..

R1#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
  Internet Address 172.30.0.1/24, Area 0


lets configure the OSPF priority, anything higher than the default of 1, will ensure this will be DR on the segment;

R1(config)#inter fa0/1
R1(config-if)#ip ospf priority ?
  <0-255>  Priority

R1(config-if)#ip ospf priority 200


BUT now we need to ensure R2 & R3 shoulfd not become a DR/BDR ... so lets change there priority to a 0

R2#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
  Internet Address 172.30.0.2/24, Area 0

R2(config)#inter FastEthernet0/0
R2(config-if)#ip ospf priority 0



R3(config)#inter fa0/0
R3(config-if)#ip ospf priority 0




Lets check out the results, we should see both R2 and R3 set as DROTHER

R1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2           0   FULL/DROTHER    00:00:36    172.30.0.2      FastEthernet0/0
3.3.3.3           0   FULL/DROTHER    00:00:30    172.30.0.3      FastEthernet0/0

and R1 is now our hard coded DR, lets check what R2 see's:

R2#show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1         200   FULL/DR         00:00:34    172.30.0.1      FastEthernet0/0
3.3.3.3           0   2WAY/DROTHER    00:00:36    172.30.0.3      FastEthernet0/0
5.5.5.5           0   FULL/  -        00:00:31    172.30.10.5     Serial0/0


Notice the priority of 200 for R1, now R2 & R3 will stay at the 2WAY state, for each other


R3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1         200   FULL/DR         00:00:31    172.30.0.1      FastEthernet0/0
2.2.2.2           0   2WAY/DROTHER    00:00:38    172.30.0.2      FastEthernet0/0
4.4.4.4           0   FULL/  -        00:00:33    172.30.20.4     Serial0/0


Notice the FULL relationships above for the other areas, these have no DR or BDR as they are a POINT-TO-POINT relationship


OBJECTIVE 4.
Implement summarization at the ABRs in the network to make the routing tables throughout the network as efficient as possible.



Remember with OSPF we can only summarise  at the ASBR and ABR, lets start with R2:


R2#show ip route | i 172.30.10.5
O       10.10.0.0 [110/201] via 172.30.10.5, 00:21:35, Serial0/0
O       10.10.1.0 [110/201] via 172.30.10.5, 00:21:35, Serial0/0
O       10.10.2.0 [110/201] via 172.30.10.5, 00:21:35, Serial0/0
O       10.10.3.0 [110/201] via 172.30.10.5, 00:21:35, Serial0/0


Lets summarise the routes we are learning from R5 (area 10) to area 0

So thinking in increments, (128,64,32,16,8,4,2,1) 4 would catch the above routes;
10.10.0.0
10.10.4.0
subnet mask /20


R2(config)#router ospf 1
R2(config-router)#area 10 range ?
  A.B.C.D  IP address to match

R2(config-router)#area 10 range 10.10.0.0 255.255.252.0






Lets check it out on R1;

R1#show ip route | i 172.30.0.2
O IA    172.30.10.0 [110/210] via 172.30.0.2, 00:30:08, FastEthernet0/0
O IA    10.10.0.0/22 [110/211] via 172.30.0.2, 00:01:53, FastEthernet0/0



SWEET!

Lets do the same for R3;


R3(config)#router ospf 1
R3(config-router)#area 20 range 10.20.0.0 255.255.252.0







Lets check it out .....

R1#show ip route | i 172.30.0.3
O IA    172.30.20.0 [110/210] via 172.30.0.3, 00:33:17, FastEthernet0/0
O IA    10.20.0.0 [110/211] via 172.30.0.3, 00:01:26, FastEthernet0/0


Koool!


OBJECTIVE 5.
Implement summarization at the ASBR. The summary route should have the same attributes as the original, individual routes redistributed into the network.

With an ASBR we dont have the area, as we could be redistributing routes from another protocol, so no area exists ....

R1(config)#router ospf 1
R1(config-router)#summary-address ?
  A.B.C.D  IP summary address

R1(config-router)#summary-address 172.16.0.0 255.255.252.0 ?
  not-advertise  Do not advertise when translating OSPF type-7 LSA
  tag            Set tag
  <cr>

R1(config-router)#summary-address 172.16.0.0 255.255.252.0


Lets check R1 and see the summary ...

R2#show ip route

     172.16.0.0/22 is subnetted, 1 subnets
O E2    172.16.0.0 [110/200] via 172.30.0.1, 00:02:00, FastEthernet0/0



It will inherit the other attributes like cost etc by default from the original route :0)


OBJECTIVE 6.
The organization plans 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)#auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
        Please ensure reference bandwidth is consistent across all routers.


This command needs to be done accross all the OSPF routes (be careful not to go tooo high on this one otherwise it will render small links like 64kbps as unreachable as the metric will be too high ( it will be mistaken for infinite ....)





I have now gone and done the rest of the routers, soooo lets look at our new metrics

BEFORE
     172.16.0.0/24 is subnetted, 4 subnets
O E2    172.16.0.0 [110/200] via 172.30.10.2, 00:07:46, Serial0/0
O E2    172.16.1.0 [110/200] via 172.30.10.2, 00:07:46, Serial0/0
O E2    172.16.2.0 [110/200] via 172.30.10.2, 00:07:46, Serial0/0
O E2    172.16.3.0 [110/200] via 172.30.10.2, 00:07:46, Serial0/0
     172.30.0.0/24 is subnetted, 3 subnets
O IA    172.30.20.0 [110/410] via 172.30.10.2, 00:10:14, Serial0/0
O IA    172.30.0.0 [110/210] via 172.30.10.2, 00:10:14, Serial0/0
C       172.30.10.0 is directly connected, Serial0/0
     10.0.0.0/24 is subnetted, 8 subnets
C       10.10.0.0 is directly connected, Loopback1
C       10.10.1.0 is directly connected, Loopback2
C       10.10.2.0 is directly connected, Loopback3
C       10.10.3.0 is directly connected, Loopback4
O IA    10.20.2.0 [110/411] via 172.30.10.2, 00:08:00, Serial0/0
O IA    10.20.3.0 [110/411] via 172.30.10.2, 00:08:00, Serial0/0
O IA    10.20.0.0 [110/411] via 172.30.10.2, 00:08:10, Serial0/0
O IA    10.20.1.0 [110/411] via 172.30.10.2, 00:08:10, Serial0/0


AFTER


R5#show ip route

     172.16.0.0/22 is subnetted, 1 subnets
O E2    172.16.0.0 [110/200] via 172.30.10.2, 00:01:07, Serial0/0
     172.30.0.0/24 is subnetted, 3 subnets
O IA    172.30.20.0 [110/4100] via 172.30.10.2, 00:01:07, Serial0/0
O IA    172.30.0.0 [110/2100] via 172.30.10.2, 00:01:07, Serial0/0
C       172.30.10.0 is directly connected, Serial0/0
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.10.0.0/24 is directly connected, Loopback1
C       10.10.1.0/24 is directly connected, Loopback2
C       10.10.2.0/24 is directly connected, Loopback3
C       10.10.3.0/24 is directly connected, Loopback4
O IA    10.20.0.0/22 [110/4101] via 172.30.10.2, 00:01:09, Serial0/0

NOTICE, the E2 route stays the same ... which is what we wanted :0)