0

i am trying to create a vpc but the ip i am providing is not accepted which is 192.168.1.1/16 but aws says i can use the following range if i set to 192.168.0.0/16 it works , i guess to an extent still some clarity would be great

When you create a VPC, we recommend that you specify a CIDR block (of /16 or smaller) from the private IPv4 address ranges as specified in RFC 1918:

10.0.0.0 - 10.255.255.255 (10/8 prefix)

172.16.0.0 - 172.31.255.255 (172.16/12 prefix)

192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
akash
  • 1
  • 2
  • 1
    192.168.1.1/16 is not valid network definition as 192.168.1.1 falls inside the 192.168.0.0/16 range - usually it is unlikely that you need 256*256 IP-addresses in a single VPC and you'd use something like `192.168.1.0/24` to be able to use the ip-addresses `192.168.1.0 - 192.168.1.255` – HBruijn Jul 25 '19 at 12:33
  • so if i want 16834 host it would be something like this right 192.0.0.0./14 am i right ? – akash Jul 25 '19 at 12:51
  • If you want to use 16834 hosts that is a `/18` , not a `/14`. There are 4 `/18` subnets in 192.168/16 that you could use: `192.168.0.0/18` `192.168.64.0/18` `192.168.128.0/18` and `192.168.196.0/18` . A `/14` on the other hand (with max 262142 hosts) ` can only be created as a subset from the 10.0.0.0/8 or 172.16/12 ranges as the IP-addresses `192.0.0.0 - 192.167.255.255` are not reserved for private use but allocated in the real world. But us a subnet calculator to learn more – HBruijn Jul 25 '19 at 13:04
  • sorry made a mistake thanks :) i counted the 1s instead of 0s for the host please let me know if below two examples are correct ! 4194304 Host - 192.0.0.0/10 32 Host - 192.168.1.0/27 – akash Jul 25 '19 at 13:22
  • Use one of the many online subnet / cidr calculators that will do the job for you much more quickly than I can explain - Look at https://serverfault.com/questions/49765/how-does-ipv4-subnetting-work and https://serverfault.com/q/630022/37681 – HBruijn Jul 25 '19 at 13:59
  • thanks @HBruijn got it :) – akash Jul 25 '19 at 14:00

1 Answers1

0

The reason my ip was not accepted in the VPC is because 192.168.1.1 is considered as single ip which is taken as 192.168.1.1/32 it is invalid as VPC CIDR needs a range of ip address like these two example.

192.168.0.0/16 
192.168.1.0/27
akash
  • 1
  • 2
  • Yeah CIDR addresses for the common sizes (/8, /16, /32) have the last quartet of the IP address 0 (eg x.x.x.0). When you get to other sizes like /27 networks they can start at other numbers - eg x.x.x.32/28. – Tim Jul 25 '19 at 18:49
  • yes tim i did not realize until others pointed thanks :) – akash Jul 25 '19 at 19:04
  • I didn't read the comments, I just wanted to add a little more right beside the answer that you will accept in 24 hours :) – Tim Jul 25 '19 at 19:15
  • haha... any input is welcome as i am a novice – akash Jul 25 '19 at 19:50