OSPF Area ID’s – Dotted or Decimal?

I had a thought the other day while at work regarding OSPF area numbers in Cisco IOS.

Having been brought up on Cisco Net Academy in college, Cisco always teaches the following command syntax:

R1(config-t)#router ospf 1
R1(config-router)#network 10.1.1.0 0.0.0.255 area 0

In fact, 90% of all Cisco documentation and command references will always express OSPF Area ID’s as decimal numbers.
One thing you probably want to keep in mind is what is actually transmitted on the wire.
As an experiment, I used area ID’s of 1000 and 2000 on two directly connected routers, and used both formats for configuring the areas.

On R1
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 10.0.0.0 0.0.0.3 area 0

On R2
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 10.0.0.0 0.0.0.3 area 0.0.0.0

As expected, the OSPF neighbors came up, since we know that when configuring area 0 as a decimal, it’s sent out irregardless as dotted decimal in OSPF packets.

R1#sh ip os int fa1/0
FastEthernet1/0 is up, line protocol is up
Internet Address 10.0.0.1/30, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1
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
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
truncated...

R2#sh ip osp int fa1/0
FastEthernet1/0 is up, line protocol is up
Internet Address 10.0.0.2/30, Area 0.0.0.0
Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DR, 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
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
truncated...

Now that I have these routers talking to each other over the backbone area, let’s see how LSA’s for the loopback areas (1000 and 2000) look when configured with decimals under Cisco IOS:


R1(config-if)#do sh run int fa1/1
Building configuration...

Current configuration : 116 bytes
!
interface FastEthernet1/1
ip address 10.10.1.1 255.255.255.0
ip ospf 1 area 1000

R2(config-if)#do sh run int fa1/1
Building configuration...

Current configuration : 116 bytes
!
interface FastEthernet1/1
ip address 10.20.1.1 255.255.255.0
ip ospf 1 area 2000

And the captures:

R1 OSPF Hello on Area 1000
R2 OSPF Hello on Area 2000

As we can see, even though we use decimal notation, OSPF packets are always sent using dotted decimal.
It’s fairly simple why, being just a matter of binary conversation of decimal numbers to dotted decimal format.
For example, R1 was configured on Area ID 1000.

Decimal 1000 in binary is = 0011 1110 1000
Expanding that out to dotted decimal, we have the following in binary = 0000 0000.0000 0000.0000 0011.1110 1000

Converting it back to dotted decimal, we see in the hellos that OSPF Area ID 1000 = Area ID 0.0.3.232.

We can do the same for R2 on Area ID 2000.

Decimal 2000 = 0111 1101 0000 binary
32-bit binary 0000 0000.0000 00000.0000 0111.1101 0000 = 0.0.7.208

So regardless of which way you configure your area ID’s, OSPF will always transmit using dotted decimal format.
While it is easy to maintain and see decimal base-10 on small OSPF networks, an area ID greater than 255 will result in the next 8-bit octet incrementing as your area ID numbers increase (ie. Area ID 256 = 0.0.1.0 in dotted decimal). While 1000 and 2000 are nice numbers in a running config, it will always transmit in dotted decimal.

Advertisements

3 Responses to OSPF Area ID’s – Dotted or Decimal?

  1. Jacob says:

    brilliant feat – short, crisp and putted in a nutshell. Thanks for this post.
    exactly what i’ am looking for

  2. Davidson says:

    Thanks for the expalnation..really useful…

  3. koo says:

    Thank you !! I got a answer to my question ..

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

%d bloggers like this: