Search code examples
amazon-web-servicescidr

CIDR block 10.0.96.32/18 overlaps with pre-existing CIDR block 10.0.96.0/28 from subnet


Wondering how does this overlap, it seems like it comes afterward.

CIDR block 10.0.96.32/18 overlaps with pre-existing CIDR block 10.0.96.0/28 from subnet-3fa92058.

enter image description here


Solution

  • Convert each quad to binary...

    $ dc -e '2o 10p 0p 96p 32p' | xargs printf '%08d\n'
    00001010
    00000000
    01100000
    00100000
    

    Now you've got the IP address as a binary number:

    00001010000000000110000000100000
    |       |       |       |
    

    The first 18 bits of that represent the network for this IP address...

    00001010000000000100000000000000
    ******************--------------
    

    Which, if you convert back to dotted quad notation, look like this:

    $ dc -e '2i 00001010 p 00000000 p 01000000 p 00000000 p'
    10
    0
    64
    0
    

    So, 10.0.64.0/18. You can also calculate your broadcast:

    $ dc -e '2i 00001010 p 00000000 p 01111111 p 11111111 p'
    10
    0
    127
    255
    

    Or, 10.0.127.255/18.

    And the network 10.0.96.0/28 is certainly within this range.