Search code examples
amazon-web-servicesipserveramazon-cloudfront

Amazon server IPs


The json for the ips is found at https://ip-ranges.amazonaws.com/ip-ranges.json

However the only ranges for 54.233 are:

54.233.0.0/ 18 54.233.64.0 / 18 54.233.128.0 / 17

It is my understanding that 54.233.0.0 / 18 means the range is 54.233.0.0 - 54.233.0.18

Yet, 54.233.86.245 is an amazon server according to who.is but is not in any of the ranges in the json.

Am I fundamentally misunderstanding something or is the list provided incorrect?


Solution

  • Yeah. That's not how subnets work.

    As pointed by Paul in comments:
    https://en.wikipedia.org/wiki/Subnetwork
    https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

    Online calculator: http://jodies.de/ipcalc

    So basically, an example: 54.233.0.0/18

    http://jodies.de/ipcalc?host=54.233.0.0&mask1=18&mask2=

    54.233.0.0/18 = all IPs between 54.233.0.1 and 54.233.63.254

    If instead of having a CIDR you have the the size of the subnet, you can get the CIDR by doing the following: 64.233.160.0 w/ a subnet size of 8192 <=> 64.233.160.0/(32-log2(8192)) <=> 64.233.160.0/19

    You can also see subnets being written as 54.233.0.0/255.255.192.0 for example. The 2nd part is the actually mask, so if you transform to binary it's actually 255.255.192.0 <=> 11111111 11111111 11000000 00000000 which in turn is 18 ones so /18. The ones in the mask are the bits that are fixed when this mask is applied over the base address (54.233.0.0 in this case). Also as a side effect the base last 32-18 bits are going to be 0.