Simple Ipv4 Prefix Summarization p

download Simple Ipv4 Prefix Summarization p

of 1

Transcript of Simple Ipv4 Prefix Summarization p

  • 7/25/2019 Simple Ipv4 Prefix Summarization p

    1/1

    Mar

    17 18 Comm ents

    A Simple IPv4 Prefix Summarization ProcedurePosted by Petr Lapukhov, CCIE #16379in IGP, IP Addressing

    About Petr Lapukhov, CCIE #16379:

    Petr Lapukhov's c areer in IT begain in 1988 w ith a focus on computer programming, and progress ed into networ king

    w ith his firs t exposure to Novell NetWare in 1991. Initially involved w ith Kazan State University's campus netw ork

    suppor t and UNIX system administration, he w ent through the path of bec oming a netw orking consultant, taking part in

    many netw ork deployment projects. Petr currently has ov er 12 years of ex perience w orking in the Cisco netw orking

    field, and is the only person in the w orld to have obtained four CCIEs in under tw o years, passing each on his f irst

    attempt. Petr is an exceptional case in that he has been w orking w ith all of the technologies cover ed in his f our CCIE

    tracks (R&S, Security, SP, and Voice) on a daily basis for many years. When not actively teaching classes, developing

    self-paced products, studying for the CCDE Practical & the CCIE Storage Lab Exam, and completing his PhD in Applied

    Mathematics.

    Find all posts by petr| Visit Website

    John Zhang

    March 17, 2010 at 10:09 am

    OT CCIE R&S and Security Boot camp in Nigeria - So Do You Want to be a CCIE? - 2bccie.com

    March 17, 2010 at 1:39 pm

    Dana

    March 17, 2010 at 2:47 pm

    OT CCIE R&S and Security Boot camp in Nigeria - So Do You Want to be a CCIE?- 2bccie.com

    March 17, 20 10 at 3:11 pm

    OT CCIE R&S and Security Boot camp in Nigeria - So Do You Want to be a CCIE? - 2bccie.com

    March 17, 2010 at 10:04 pm

    Carlos Farinha

    March 18, 2010 at 4:36 am

    Deepak Arora

    March 18, 2010 at 8:39 am

    OT CCIE R&S and Security Boot camp in Nigeria - So Do You Want to be a CCIE? - 2bccie.com

    March 18, 2010 at 12:12 pm

    Bilal Hansrod

    March 18, 2010 at 7:51 pm

    Nish Vamadevan

    March 19, 2010 at 3:28 am

    shivlu jain

    March 20, 2010 at 7:41 am

    Bilal Hansrod

    March 22, 2010 at 9:02 pm

    Nish Vamadevan

    March 24, 2010 at 3:28 am

    Bilal Hansrod

    March 28, 2010 at 8:58 pm

    Dev13

    May 4, 2010 at 6:18 am

    Petr Lapukhov, CCIE #16379

    May 4, 2010 at 8:01 am

    Dev13

    May 4, 2010 at 8:18 am

    Petr Lapukhov, CCIE #16379

    May 4, 2010 at 9:48 am

    Overview

    In this short blog post we are going to present a simple procedure for IPv4 prefix summarization. The

    procedure is based on the one found in Optimal Routing Design book by Russ White, Don Slice and Alvaro

    Retana, but differs in some respects. The process is three step, and require the use of Windows calculator for

    ease of computation. No binary breakdowns are involved, just some basic arithmetic. For the sake of simplicity, we

    skip all proofs, as those are trivial. The same approach could be adopted for use with IPv6 prefixes, provided that

    decimal arithmetic is replaced with hexadecimal.

    Scenario

    We are going to use an example to demonstrate the method. Here is the task: find the optimal (longest prefixlength) summary prefix for the following set of subnets:

    192.168.100.0/22

    192.168.101.0/24

    192.168.99.0/24

    192.168.102.0/24

    192.168.105.0/24

    192.168.98.0/23

    This example is taken from the wikipedia article: http://en.wikipedia.org/wiki/Supernet that illustrates the use of

    binary breakdown for the purpose of address summarization.

    Preparations

    It does not matter if the subnets have different prefix lengths you may simply ignore these, as the resulting

    summary will use its own prefix length. Sort the prefixes in ascending order, starting with lowest and to the highest

    32-bit number. Find the octet where the prefixes differ (we would call it changing octet from here on). In our case

    this is the 3rd octet (98, 99 etc):

    192.168.98.0/23

    192.168.99.0/24

    192.168.100.0/22

    192.168.101.0/24

    192.168.102.0/24

    192.168.105.0/24

    You only need to sort the prefixes to find the lowest and the highest changing octet values. The changing octet

    position also gives us the corresponding positional prefix length. If this octet is the first in the prefix, the positional

    prefix length is 8, if its the second then the positional prefix length is 16, next 24 for third and 32 for fourth position

    in the dotted-decimal form.

    Step 1:

    Take the highest and lowest changing octets and perform XOR operation on them. You may use Windows

    calculator or any other utility that allows for logical operations on decimal numbers: 98 XOR 105 = 11 . Next, take

    the lowest power of 2 that is strictly greater than the resulting number (even if the result is a power of two itself).In our case it is 16. Lets call this number as y. After that, find the number z, so that 2^z=y (here ^ means

    power, not XOR like in C), i.e. take Log2 of y: z = Log2(y) = Log2(16) = 4 . You may use a short table of powers

    of 2 ranging from 2^0 to 2^8 you dont need more as you deal with just a single octet. Its easy to memorize these

    numbers too. Notice that dealing with IPv6 would require the table of 16 elements(2^0 through 2^16).

    Note The original method found in Optimal Routing Design uses subtraction operation instead of XOR at this

    step. It could be shown that subtraction does not work in all cases. For example, it does not reveal the correct

    highest mismatching bit position in the case of: 10.1.66.0 and 10.1.69.0 as 69-66=3 (incorrectly approximated by

    2 2) while 69 XOR 66 = 7 (correctly appr oximated by 2 3). The reason being are arithmetic underflows that

    happen with subtraction.

    Step 2:

    Take the any changing octet value, e.g. the lowest one, and divide it by y then drop the remainder: 98/16 =

    6.125 rounded to 6 (floor function). Now multiply 6 by y again to yield 96 this is the base octet of the

    summary address. The summary prefix now looks like: 192.168.96.0. Effectively, these two operations represent

    logical binary shift right and left to mask the changing bits. Yes, you may take ANY octect from the set of prefixes

    the result will be the same.

    Step 3:

    The final step is finding the summary prefix length. Take the positional prefix length corresponding to the changing

    octet, as described previously. In our case its the third octet, and thus the positional prefix length is 24. Now

    subtract z from this number to get x the summary prefix length: x=24-z=24-4=20 . The summary prefix is:

    192.168.y.0/x = 192.168.96.0/20

    Step 4 (Optional):

    Convert prefix length into network mask, if needed. To accomplish this, take 256 and subtract y: 256-16=240.

    This is the netmask component that corresponds to the summary base octet: 192.168.96.0 255.255.240.0

    Example 1

    Take the following subnets:

    10.1.57.0/24

    10.1.59.0/24

    10.1.61.0/24

    Changing octet 3rd, positional prefix length = 24. Next step: 61 XOR 57 = 4 thus y = 8, z=3; 57/y = 57/8 =

    7.125 and the base octet is 7*8=56 . The prefix length is 24-3=21 . Summary prefix is: 10.1.56.0/21 or 10.1.56.0

    255.255.248.0

    Example 2

    Take the following subnets:

    192.168.97.0/23192.168.100.0/22

    Changing octet 3rd, positional prefix length = 24. Next step: 100 XOR 97 = 5 , y = 8, z = 3 97/8 = 12.125 , base

    = 12*8=96 . The prefix length = 24-3=21 . Summary Prefix: 192.168.96.0/21 or 192.168.96.0 255.255.248.0

    Example 3

    Take the following subnets:

    172.16.14.0/24

    172.16.17.0/24

    172.16.25.0/24

    Changing Octet 3rd, positional pr efix length = 24. Next Step: 25 XOR 14 = 23, y = 32, z = 5; 14/32 = 0.43 , base

    octet = 0. Summary length: 24-5=19 . Summary prefix: 172.16.0.0/19 or 172.16. 0.0 255.255.224.0. Notice that

    this summary address could be too exhaustive in terms of overlapped address space. You may want to summarize

    just two prefixes: 172.16.17.0 and 172.16. 25.0 and leak 172.16.14.0: summary of 172.16.17.0 and 172.16.25.0 =

    172.16.16.0/20 and 172.16.14.0/24is left un-summarized.

    Conclusions

    The procedure presented in this article could be useful when dealing with large-scale networks and configuring

    manual IPv4 prefix summarization. You may avoid complicated binary conversions and simply use the calculator to

    find the resulting prefix.

    Tags: address summarization, ipv4 summarization, supernets

    Download this page as a PDF

    You can leave a res ponse, or trackbackfrom your own site.

    18 Responses to A Simple IPv4 Prefix Summarization Procedure

    Great shortcut. Thanks

    [...] Core Knowledge Is Priceless Test Yours Today: Q: What is the the optimal (longest prefix length) summary for the following set

    of subnets 192.168.100.0/22; 192.168.101.0/24; 192.168.99.0/24; 192.168.102.0/24; 192.168.105.0/24; 192.168.98.0/23? A:

    192.168.96.0/20 More Info: http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/[...]

    I love the way this was explained. A nice resource for many. Great work Petr!

    [...] 192.168.105.0/24; 192.168.98.0/23? > A: 192.168.96.0/20 > More Info: > > http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-

    summarization-procedure/ > > On Mar 17, 2010, at 4:27 PM, Mark Anthony wrote: > > > Hello GS, > > > [...]

    [...] 192.168.98.0/23? > > A: 192.168.96.0/20 > > More Info: > > > > > http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-

    summarization-procedure/ > > > > On Mar 17, 2010, at 4:27 PM, Mark Anthony wrote: > > > > > Hello [...]

    Hi Petr,

    Thanks for your post, as usual really well explained and very useful.

    Please just correct the typo on example 3, just to avoid confusing anyone reading the post, it should be 14/32(y) not 14/23.

    Thanks once again!

    Carlos

    Hey Petr can you write some good detailed article on Prefix Lists from binary prospective. I know most people feel that its very easy

    though. But there are many out there like me who still want to

    understand it from binary point of view specially when someone asks something like : Construct a prefix list that denies any prefix for

    which the most-s ignificant four bits are 0110 , and permits everything else.

    Thanks!

    Deepak Arora

    [...] 192.168.98.0/23? > > A: 192.168.96.0/20 > > More Info: > > > > http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-

    summarization-procedure/ > > > > On Mar 17, 2010, at 4:27 PM, Mark Anthony wrote: > > > > > Hello [...]

    Hi Petr,

    How did you derive y? I still cant get my head around:)

    Regards,

    Bilal

    Bilal,

    A Xor B = C

    2^D = E

    E is a power of 2 which is greater than C, where D is the power you are using.

    In his case,

    A = 98

    B = 105

    Hence C = 11 (98 Xor 105)

    So

    2^D > 11 and that is E

    2^4 = 16 = E (In the Example it is Y)

    Thanks by doing I get rid from the binary and it saves lot of time.

    Thanks Nish-

    It looks like E Or Y is always greater than C value. so if Xor value is 32 than it would be 2^6 and E or Y becomes 64.

    Am I right?

    Bilal, that is correct.

    The Value of Y needs to be

    lowest power of 2 that is strictly greater than the resulting number

    2^5 = 32 is the same value so you need to go one one more power which is 2^6 = 64, which is correct.

    Thanks Nish

    Guys,

    In case of

    222.222.221.1/24

    222.222.222.1/24

    222.222.223.1/24

    What will be the summary address I can use?

    @Dev13

    the summary is 222.222.220/22

    so Petr in my case y=4 as 221XOR223=2 so I have to take Y strictly greater than the XOR result right? so it will be 4. Then I will do

    Log2(4) which will give me result of 2 and that is 24-2=22 and that will be my mask. and for 3rd octet 221/4=55.25 and I will take 55

    by leaving reminder and again 554=220, so that way 222.222.220.0/22 is the result right?

    So for Y it has to be greater than, it is not equal to the XOR result.

    @Devin13:

    Quote from the blog post:

    Take the highest and lowest changing octets and perform XOR operation on them. You may use Windows calculator or any other

    utility that allows for logi cal operations on decim al num bers: 98 XOR 105 = 11 . Next, take the lowes t power of 2 that is strictly

    greater than the resulting number (even if the result is a power of two itself)

    Leave a Reply

    Name (required)

    Mail (will not be published) (required)

    Website

    Submit Comment

    Search the Blog

    Search

    Submit

    Categories

    Select Category

    Current Poll

    I would place a value of ___

    on the ability to take away

    PDF's of all instructor

    whiteboard activity during a

    Live or Online coursedelivered by INE. (1-lowest,

    10-highest value)

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    Vote

    View Results

    Polls Arc hive

    CCIE Bloggers

    Brian Dennis CCIE #2210

    Routing & Switc hing

    ISP Dial

    Security

    Service Provider

    Voice

    Scott Morris CCIE #4713

    Routing & Switc hing

    ISP Dial

    Security

    Service Provider

    Brian McGahan CCIE #8593

    Routing & Switc hing

    Security

    Service Provider

    Petr Lapukhov CCIE #16379

    Routing & Switc hing

    Security

    Service Provider

    Voice

    Anthony Sequeria CCIE #15626

    Routing & Switc hing

    Marvin Greenlee CCIE #12237

    Routing & Switc hing

    Security

    Service Provider

    Keith Barker CCIE #6783

    Routing & Switc hing

    Security

    Mark Snow CCIE #14073

    Voice

    Security

    Josh Finke CCIE #25707

    Voice

    Popular Tags

    35503560announcementasa

    betablueprintCCENTccieccie2.0CCIE VoiceCCNA

    CCNPciscocorecustomer-

    focuseigrpexamfilteringfirewalliewbiewb-rsios

    knowledgelabMPLSmulticastnewsospfpix

    practicesampleSecurity

    shapingstpstrategystudytipstrainingtroubleshootingupdateupdatesv5vol1vol2written

    witter.com/inetraining

    An investment in knowledge alw ays

    pays the best interest -Benjamin

    Franklin http://bit.ly/cVdRKd(Mark

    Snow , CCIE #14073)

    Apologies f or the short dow ntime on

    http://ine.com.We ran some quick

    maintenance, but everything should

    be w orking again :)

    Ask INE #3 http://bit.ly/9Eib70. Your

    #ccie questions answ ered!

    Blog Home| INE Home| Members| Contact Us

    2010 Internetwork Expert, Inc., All Rights Reserved

    Submit a Question View Archives Training Products CCIE Bloggers

    http://blog.ine.com/tag/troubleshooting/http://blog.ine.com/tag/beta/http://blog.ine.com/tag/blueprint/http://blog.ine.com/tag/ccent/http://blog.ine.com/tag/ccie/http://blog.ine.com/tag/announcement/http://blog.ine.com/tag/asa/http://www.ine.com/about-mark-snow.htmhttp://www.ine.com/about-anthony-sequeira.htmhttp://www.ine.com/about-instructors.htmhttp://blog.ine.com/?author=5http://blog.ine.com/?author=5http://www.fnode.com/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-101601http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-101363http://www.mplsvpn.info/http://www.fnode.com/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/http://www.2bccie.com/cisco-certification/ccie-ot-ccie-rs-and-security-boot-camp-in-nigeria-5.htmlhttp://deepakarora1984.blogspot.com/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/http://www.2bccie.com/cisco-certification/ccie-ot-ccie-rs-and-security-boot-camp-in-nigeria-4.htmlhttp://www.2bccie.com/cisco-certification/ccie-ot-ccie-rs-and-security-boot-camp-in-nigeria-3.htmlhttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100376http://www.2bccie.com/cisco-certification/ccie-ot-ccie-rs-and-security-boot-camp-in-nigeria-2.htmlhttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/#respondhttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/trackback/http://blog.ine.com/?author=5http://blog.ine.com/?author=5http://www.ine.com/about-brian-mcgahan.htmhttp://blog.ine.com/pollsarchivehttp://blog.ine.com/http://blog.ine.com/http://blog.ine.com/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/#commentshttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/http://blog.ine.com/?author=5http://blog.ine.com/category/ccie-routing-switching/interior-gateway-routing/http://blog.ine.com/category/ccent/ip-addressing/http://blog.ine.com/?author=5http://blog.ine.com/?author=5http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100319http://www.2bccie.com/cisco-certification/ccie-ot-ccie-rs-and-security-boot-camp-in-nigeria-2.htmlhttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100365http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100376http://www.2bccie.com/cisco-certification/ccie-ot-ccie-rs-and-security-boot-camp-in-nigeria-3.htmlhttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100383http://www.2bccie.com/cisco-certification/ccie-ot-ccie-rs-and-security-boot-camp-in-nigeria-4.htmlhttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100449http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100505http://deepakarora1984.blogspot.com/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100537http://www.2bccie.com/cisco-certification/ccie-ot-ccie-rs-and-security-boot-camp-in-nigeria-5.htmlhttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100560http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100624http://www.fnode.com/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100681http://www.mplsvpn.info/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-100891http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-101363http://www.fnode.com/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-101601http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-102614http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-108518http://blog.ine.com/?author=5http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-108534http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-108536http://blog.ine.com/?author=5http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/comment-page-1/#comment-108553http://en.wikipedia.org/wiki/Supernethttp://www.ine.com/ccie-routing-switching-training-program.htm?utm_source=blog&utm_medium=banner&utm_campaign=blogbannerhttp://blog.ine.com/tag/address-summarization/http://blog.ine.com/tag/ipv4-summarization/http://blog.ine.com/tag/supernets/http://pdfcrowd.com/url_to_pdf/?height=-1http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/#respondhttp://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/trackback/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/http://blog.ine.com/2010/03/17/a-simple-ipv4-prefix-summarization-procedure/#ViewPollResultshttp://blog.ine.com/pollsarchivehttp://www.ine.com/about-brian-dennis.htmhttp://www.ine.com/about-scott-morris.htmhttp://www.ine.com/about-brian-mcgahan.htmhttp://www.ine.com/about-petr.htmhttp://www.ine.com/about-anthony-sequeira.htmhttp://www.ine.com/about-marvin-greenlee.htmhttp://www.ine.com/about-keith-barker.htmhttp://www.ine.com/about-mark-snow.htmhttp://www.ine.com/about-josh-finke.htmhttp://blog.ine.com/tag/3550/http://blog.ine.com/tag/3560/http://blog.ine.com/tag/announcement/http://blog.ine.com/tag/asa/http://blog.ine.com/tag/beta/http://blog.ine.com/tag/blueprint/http://blog.ine.com/tag/ccent/http://blog.ine.com/tag/ccie/http://blog.ine.com/tag/ccie20/http://blog.ine.com/tag/voice/http://blog.ine.com/tag/ccna/http://blog.ine.com/tag/ccnp/http://blog.ine.com/tag/cisco/http://blog.ine.com/tag/core/http://blog.ine.com/tag/customer-focus/http://blog.ine.com/tag/eigrp/http://blog.ine.com/tag/exam/http://blog.ine.com/tag/filtering/http://blog.ine.com/tag/firewall/http://blog.ine.com/tag/iewb/http://blog.ine.com/tag/iewb-rs/http://blog.ine.com/tag/ios/http://blog.ine.com/tag/knowledge/http://blog.ine.com/tag/lab/http://blog.ine.com/tag/mpls/http://blog.ine.com/tag/multicast/http://blog.ine.com/tag/news/http://blog.ine.com/tag/ospf/http://blog.ine.com/tag/pix/http://blog.ine.com/tag/practice/http://blog.ine.com/tag/sample/http://blog.ine.com/tag/security/http://blog.ine.com/tag/shaping/http://blog.ine.com/tag/stp/http://blog.ine.com/tag/strategy/http://blog.ine.com/tag/study/http://blog.ine.com/tag/tips/http://blog.ine.com/tag/training/http://blog.ine.com/tag/troubleshooting/http://blog.ine.com/tag/update/http://blog.ine.com/tag/updates/http://blog.ine.com/tag/v5/http://blog.ine.com/tag/vol1/http://blog.ine.com/tag/vol2/http://blog.ine.com/tag/written/http://twitter.com/inetraininghttp://twitter.com/inetraininghttp://bit.ly/cVdRKdhttp://ine.com./http://bit.ly/9Eib70http://twitter.com/inetraininghttp://www.facebook.com/inetraininghttp://www.youtube.com/INEtraininghttp://blog.ine.com/feed/http://www.linkedin.com/companies/144650http://www.w3counter.com/http://blog.ine.com/http://www.ine.com/http://members.ine.com/http://www.ine.com/contact.htmhttp://feeds.feedburner.com/ine/mailto:[email protected]?subject=IE%20Blog%20Submissionhttp://blog.ine.com/archiveshttp://blog.ine.com/training-products/http://www.ine.com/about-instructors.htmhttp://pdfcrowd.com/