cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
920
Views
27
Helpful
12
Replies

OSPF Configuration ... making it small ?

hassaan_st
Level 1
Level 1

I have got a confusion with regard to OSPF configuration.

Lets assume that i have the following OSPF commands configured on a router.

router ospf 1

network 100.100.50.156 0.0.0.3 area0

network 100.100.50.164 0.0.0.3 area0

network 100.100.50.160 0.0.0.3 area0

network 100.100.50.168 0.0.0.3 area0

network 100.100.50.144 0.0.0.3 area0

network 100.100.50.152 0.0.0.3 area0

network 100.100.50.140 0.0.0.3 area0

network 100.100.50.148 0.0.0.3 area0

Adding these lines would make a lot of effort. My question is, can we make our task small rather by adding only a single command ?

i.e.

router ospf 1

network 100.100.50.128 0.0.0.63

Waiting for a reply

regards

Hassaan

1 Accepted Solution

Accepted Solutions

Hi Hassan,

You will still have to declare the OSPF process in order to get it started, as in router ospf 1. You may also want put some other config under the process if you need it, e.g. stub settings, redistribution, router-id, etc. But at least you can do away with the messy network statements.

I cannot remember when the command was introduced, but I think it was around 12.2(13)T. It is particularly useful - almost essential - when you have an unnumbered interface where you want OSPF to run, but not on the interface supplying its IP address. I'm not sure why Cisco kept so quiet about the feature, but in IPv6 it is the only way to get OSPF running on an interface.

Kevin Dorrell

Luxembourg

BTW, thanks for the rating Rick!

View solution in original post

12 Replies 12

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Hassaan,

the answer is yes.

Think of the network ... area command as a line in a ACL: all the interfaces whose IP addresses match the network command are initialized by OSPF as member links of area 0.

hope to help

Giuseppe

Hi there

Apologies, I do not mean to hijack this thread, but I am a little confused about the summarisation used to aggregate these 8 x /30 subnets into a single statement.

8 x /30 subnets yeilds 32 IP addresses, so I initailly go for 100.100.50.140/27 (255.255.255.224) which covers a block of 32 addresses.

However, when I work it out in binary I arrive at a /26 mask (255.255.255.192).

100.100.50.140 = 01100100 01100100 00110010 10 001100

100.100.50.168 = 01100100 01100100 00110010 10 101000

As you can see the first 26 bits are the same in the first and last subnet number, give em a mask of /26 (255.255.255.192), however this covers a range of 64 addresses.

I don't understand why this happened. Can anybody shed any light on this please?

Best Regards,

Michael

Michael

It is all to do with bit boundaries and how the router knows where to start the subnet. An example will definitely help. So 10.100.50.x with a /27 subnet mask gives you the following subnets

100.100.50.0

32

64

96

128

160

So you are trying to summarise from 100.100.50.140 -> 100.100.50.168. But you cannot start at 100.100.50.140 with a /27 subnet mask because as you can see from above you either start at 100.100.50.128 or 100.100.50.160. In other words 100.100.50.140 -> 100.100.50.168 does not fall within one of the ranges, it overlaps ranges.

So try with a /26 subnet mask

100.100.50.0

.64

.128

.192

Now this works because you are trying to summarise from 100.100.50.140 -> 168 and all these subnets fall within the 100.100.50.128/26 subnet.

So it is important to note that 100.100.50.128 255.255.255.192 includes a lot more subnets than the OP wants to summarise but as long as they are not used anywhere else that shouldn't be a problem.

By the way when subnetting up a class C with VLSM this is why it is often better to start your /30 networks from the end of the range and work backwards. That way you have maximum flexibility in how you split up your class C.

Hope this makes sense.

Jon

Hi John

Thanks you for the response and answer. I had taken this up to tea break with me and had figured out where I was going wrong.

I am so used to having clean subnets to summarise from studying that I did not count the value of the first 26 bits, which is of course 100.100.50.128. I had assumed (incorrectly) that the valuse was 140, as normally in the study examples the first subnet is always the addresses summarised and you really just have to work out the appropriate mask. And as I was summarising 32 IP addresses I again assumed (incorrectly) that I should be able to use a /27 mask and was beginning to doubt my sanity :)

Again thanks for the response, much appreciated.

Best Regards,

Michael

Dear Giuseppe,

Thanks for your reply.This certainly clears my doubts.However i am just assuming another scenario.

"network 100.100.50.128 0.0.0.63" would work fine, as it covers all the networks i have mentioned above.However you must have noticed that the last network in my list is "100.100.50.168", whereas the above mentioned command (network 100.100.50.128 0.0.0.63) also covers those IPs which are not required by me (i.e. 168 onwards till 191).

This might not be a secure way...so my question is that can we further modify our command like this;

network 100.100.50.128 0.0.0.40 ?

Probably we cant because the range for /26 is from '128 to 191'

I hope i managed to explain my point?

Regards

Hassaan

There is a problem with configuring network 100.100.50.128 0.0.0.40 and the problem is that OSPF requires that the bits in the mask be contiguous. There were some releases in the past that would permit discontiguous mask in the OSPF network statement but now all releases require that the mask bits be contiguous. So it would not work.

And even if OSPF accepted a mask of 0.0.0.40 it would not accomplish what you want. The mask is not a counter of how many addresses but is used to identify which bits in the address should be considered for including interfaces into the protocol.

So your choice is to configure a single network statement using a mask that includes more than you really need or to configure multiple network statements and get exactly the networks you want and no extra.

HTH

Rick

HTH

Rick

Dear Hassaan,

as Rick has explained you cannot play with the wildcard mask. With modern IOS versions you can use the interface based approach (like IS-IS has been doing for years, but also like OSPFv3 for IPv6 ! ) as explained by Kevin.

But this is not a limit because it makes you think of your address plan: from another point of view you are declaring that a block of IP addresses is associated to area X (X=0 in your case). Even if you are not using all of this block now, you leave space for additional links in the same area for the future and this is a good point in network design (ability to grow).

For non-backbone areas you can define your area-id = the area's aggregate address because the area-id is a 32bit number that can be represented in the dotted decimal format like an IP address. So area 0 can be thought as 0.0.0.0.

Area 1 should be 0.0.0.1.

Area 10.55.0.0 can represent its own aggregate 10.55.0.0/16 for example.

Someone uses this convention/practice.

Hope to help

Giuseppe

Kevin Dorrell
Level 10
Level 10

Hassaan,

There is another way of doing it which sometimes looks a lot neater. That is, don't put in any network statements at all, but simply put ip ospf 1 area 0 in the interface configs of those interfaces where you want OSPF to run. Since it is the same command on all the interfaces, the effort can be considerably reduced.

Kevin Dorrell

Luxembourg

Kevin

That is quite an interesting feature. Thanks for pointing it out.

rated as deserved.

HTH

Rick

HTH

Rick

Thanks to every1 ...

atleast one thing is clear that we cant play with wild-card mask ...

Kevin you have mentioned a very interesting command as i was not aware of it.So does this mean that we dont need to configure OSPF in the configuration mode at all?

regards

Hassaan

Islamabad

Hi Hassan,

You will still have to declare the OSPF process in order to get it started, as in router ospf 1. You may also want put some other config under the process if you need it, e.g. stub settings, redistribution, router-id, etc. But at least you can do away with the messy network statements.

I cannot remember when the command was introduced, but I think it was around 12.2(13)T. It is particularly useful - almost essential - when you have an unnumbered interface where you want OSPF to run, but not on the interface supplying its IP address. I'm not sure why Cisco kept so quiet about the feature, but in IPv6 it is the only way to get OSPF running on an interface.

Kevin Dorrell

Luxembourg

BTW, thanks for the rating Rick!

Dear Kevin, Rick, and Giuseppe ...

thanks for the valuable information :)

regards

Hassaan

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card