OSPF Lab

OSPF Lab
OSPF is configured on routers R2 and R3. R2’s S0/0 interface and R3’s S0/1 interface are in Area 0. R3’s Loopback0 interface is in Area 3.

topology
ospf lab topology

Tasks:

R1’s S0/0 interface in Area 12
R2’s S0/1 interface in Area 12
Use the appropriate mask such that only R1’s S0/0 and R2’s S0/1 could be in Area 12.
Area 12 should not receive any external or inter-area routes (except the default route).

Solution and Explanations:

The tasks states that we need to configure R1’s S0/0 and R2’s S0/1 interfaces in area 12, that too using an appropriate mask such that only R1’s s0/0 and R2’s s0/1 in area 12. So here we need to device wild card bits. If you look at the IP address on the Serial link between R1 and R2 the mask is /30 (CIDR) i.e. 255.255.255.252. Now we know that /30 means there will only two usable IP addresses and this is a preferred method of assigning IP addresses on serial interfaces. To get a perfect wild card bits to include just two IP addresses we need to subtract the default mask of 255.255.255.252 from 255.255.255.255

255.255.255.255

255.255.255.252

============

0.      0.      0.    3 (wild card bits)

============

It is easy to find out the wild card bits if the mask (/30) is in CIDR notation. However, if it is a class full mask like (/8, /16 or /24) it wouldn’t be a perfect one. In such case take down the IP addresses and do binary calculation. Like in the network the IP addresses between R1 and R2 are: 192.168.4.5 and 192.168.4.6

192.168.4.5

192.168.4.6

Now convert the fourth octet into binary and group the common bits. The first to third octets are already common, because all the octets are same 192.168.4;

128 64 32 16 8 4 2 1
5 0 0 0 0 0 1 0 1
6 0 0 0 0 0 1 1 0

Now count the number of bits that are common from the above conversion, it is 6 bits right? Now add all the common bits from each octet to get the mask (CIDR).

The first octet of both IP address is 192 i.e. all 8 bits are common

The second octet of both IP address is 168 i.e. all 8 bits are common

The third octet of both IP address is 4 i.e. all 8 bits are common.

In the fourth octet the IP addresses are different 5 and 6 so there are 6 common bits.

Therefore the sum of all common bits would be: 8+8+8+6 = 30

This (30) is the CIDR notation to represent the mask.

Now we need to derive subnet mask for each octet. Smart people can tell it just looking at those common bits, which is 255.255.255.252

If you are not good at IP addressing than using following table one can get the mask.

Mask                 128      192      224      240      248      252      254      255

Bits Position       1        2          3           4            5           6          7          8

Now again we don’t have to worry about the first three octets because all them are common. So the mask would be 255. How? and why?

8 bits common means all 8 bits are all 1s =11111111 = 255 (1+2+ 4+8+16+32+64+128 Binary values)

Thus we get the following subnet mask!

8

8 8 6
11111111. 11111111. 11111111.

11111100

255. 255. 255.

252

Once we get the subnet mask we can use inverse mask to get the wild card bits.

255.255.255.255

255.255.255.252

===========

0.       0.    0.    3 (wild card bits)

===========

So with this we have found out the exact wild card bits to include only 192.168.4.5 and 192.168.4.6 ip addresses into OSPF area 12. See the configuration below.

R1(config)#router ospf 1

R1(config-router)#network 192.168.4.4 0.0.0.3 area 12

R1(config-router)#end

R2(config)#router ospf 1

R2(config-router)#network 192.168.4.4 0.0.0.3 area 12

R2(config-router)#end

If you are not sure about the network address (192.168.4.4) that I have used above than refer here

Now our second task is to prevent any external or inter-area routes into area 12 except the default route.

To achieve this task we have to apply the OSPF concept of TSA (totally stubby area) in area 12. TSA is cisco propriety and a router on which you are configuring TSA has to be a cisco router. By configuring area 12 as a TSA it blocks type 3, 4, and 5 LSAs from entering into area 12.

OSPF LSA Types and its details

LSA Type Description Details
1 Router LSA Generated by all routers in an area to describe their directly attached links
2 Network LSA Advertised by the DR of the broadcast network (does not cross ABR)
3 Summary LSA Advertised by the ABR of origination area
4 Summary LSA Generated by the ABR of the originating area to advertise an ASBR to all other areas in the AS
5 AS external LSA Used by the ASBR to advertise networks from other AS
7 Defined for NSSAs Generated by an ASBR inside a Not-so-stubby area to describe routes redistributed into the NSSA

 

OSPF LSA types that are allowed and are not allowed in area types.

Area Type Type 1 &2 (within area ) Type 3 (from other area) Type 4 Type 5 Type 7
Standard & Backbone Yes Yes Yes Yes Yes
Stub Yes Yes No No No
TAS Yes No No No No
NSSA Yes Yes No No No
TAS NSSA Yes No No No Yes

 

With this information let’s go and check the routing table of R1 and see what kind of routes are there.

Gateway of last resort is not set

192.168.4.0/30 is subnetted, 1 subnets

C       192.168.4.4 is directly connected, Serial0/0

R1#

Just the directly connected network only.

Let’s configure area 12 as a TSA, for this you need to configure R1 as a stub and R2 as a stub with no-summary keyword:

R1#config t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#router ospf 1

R1(config-router)#area 12 stub

 

ABR

R2(config)#router ospf 1

R2(config-router)#area 12 stub no-summary

 

Now let’s check the routing table of R1.

R1#sh ip route

Gateway of last resort is 192.168.4.6 to network 0.0.0.0

192.168.4.0/30 is subnetted, 1 subnets

C       192.168.4.4 is directly connected, Serial0/0

O*IA 0.0.0.0/0 [110/65] via 192.168.4.6, 00:00:21, Serial0/0

R1#

As expected we have a default route from the ABR (R2 router).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s