Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Attention: The Community will be in read-only mode on 12/14/2017 from 12:00 am pacific to 11:30 am.

During this time you will only be able to see content. Other interactions such as posting, replying to questions, or marking content as helpful will be disabled for few hours.

We apologize for the inconvenience while we perform important updates to the Community.

New Member

How to read the ospf area id on Nexus

Hi All,

When we are going to specify the opsf area id, we can use two different notations:

- A decimal number in the range from 0 to 4294967295

- dotted-decimal notation similar to an IP address, such as A.B.C.D.

            

Now, let´s assume I want to define one area with id 259.

How can I define it in dotted-decimal notation?

Many thanks.      

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: How to read the ospf area id on Nexus

Hi Fabio,

Now, let´s assume I want to define one area with id 259.

This is about integer arithmetics in computers. Notice that a single octet can hold numbers in the range of 0-255. If you want a larger number, you need to use two octets. Here, you can have numbers of the form <0-255>.<0-255> (65536 values in total, 256x256). If you take into account that 255 can be written as 0.255, and 256 is logically 1.0, then 259=256+3=1.3.

When extending it to 4B numbers, this basic principle is retained. Assuming you have an area number N in a linear format, then its dotted decimal format A.B.C.D would be computed as follows:

A = N DIV 2^24

B = (N DIV 2^16) MOD 256

C = (N DIV 2^8) MOD 256

D = N MOD 256

For example, with N = 259:

A = 259 DIV 16777216 = 0

B = (259 DIV 65536) MOD 256 = 0 MOD 256 = 0

C = (259 DIV 256) MOD 256 = 1 MOD 256 = 1

D = 259 MOD 256 = 3

The resulting number is 0.0.1.3. To verify, the linear number should be computed back as A*2^24 + B*2^16 + C*2^8 + D = 0+0+1*256+3 = 259

With N = 942639582:

A = 942639582 DIV 16777216 = 56

B = (942639582 DIV 65536) MOD 256 = 14383 MOD 256 = 47

C = (942639582 DIV 256) MOD 256 = 137

D = 942639582 MOD 256 = 22

The resulting number is 56.47.137.222. To check back: A*2^24 + B*2^16 + C*2^8 + D = 56*2^24 + 47*2^16 + 137*2^8 + 222 = 942639582.

Do you have a Python interpreter handy? It's quite easy to write a script to convert between these two formats.

Best regards,

Peter

2 REPLIES
Cisco Employee

Re: How to read the ospf area id on Nexus

Hi Fabio,

Now, let´s assume I want to define one area with id 259.

This is about integer arithmetics in computers. Notice that a single octet can hold numbers in the range of 0-255. If you want a larger number, you need to use two octets. Here, you can have numbers of the form <0-255>.<0-255> (65536 values in total, 256x256). If you take into account that 255 can be written as 0.255, and 256 is logically 1.0, then 259=256+3=1.3.

When extending it to 4B numbers, this basic principle is retained. Assuming you have an area number N in a linear format, then its dotted decimal format A.B.C.D would be computed as follows:

A = N DIV 2^24

B = (N DIV 2^16) MOD 256

C = (N DIV 2^8) MOD 256

D = N MOD 256

For example, with N = 259:

A = 259 DIV 16777216 = 0

B = (259 DIV 65536) MOD 256 = 0 MOD 256 = 0

C = (259 DIV 256) MOD 256 = 1 MOD 256 = 1

D = 259 MOD 256 = 3

The resulting number is 0.0.1.3. To verify, the linear number should be computed back as A*2^24 + B*2^16 + C*2^8 + D = 0+0+1*256+3 = 259

With N = 942639582:

A = 942639582 DIV 16777216 = 56

B = (942639582 DIV 65536) MOD 256 = 14383 MOD 256 = 47

C = (942639582 DIV 256) MOD 256 = 137

D = 942639582 MOD 256 = 22

The resulting number is 56.47.137.222. To check back: A*2^24 + B*2^16 + C*2^8 + D = 56*2^24 + 47*2^16 + 137*2^8 + 222 = 942639582.

Do you have a Python interpreter handy? It's quite easy to write a script to convert between these two formats.

Best regards,

Peter

New Member

Re: How to read the ospf area id on Nexus

Hi Peter,

Clear, it make sense.

Thanks!!

187
Views
0
Helpful
2
Replies
CreatePlease to create content