大网数据广告活动
服务器运维问答

AWS flagged my subnet as invalid although it looks to be within the VPC CIDR block

· 52CE 我爱测

My VPC CIDR block is 10.0.0.0/16 As I understand it, this should support 256 (effectively 254) subnets with 65534 hosts per subnet. When I tried to create one subnet 10.8.0.0/24 and associate it with the VPC, I received this erro…

问题原文

原帖链接 · Bon Ami · CC BY-SA 4.0

My VPC CIDR block is 10.0.0.0/16 As I understand it, this should support 256 (effectively 254) subnets with 65534 hosts per subnet.

When I tried to create one subnet 10.8.0.0/24 and associate it with the VPC, I received this error:

Error creating subnet: 
  InvalidSubnet.Range: The CIDR '10.8.0.0/24' is invalid.

An address like 10.8.0.1 belongs to the subnet 10.8.0.0 which looks to be inside 10.0.0.0/16. Perhaps I am misguided in my understanding. Please explain where I went wrong.

已采纳解答

原帖链接 · MLu · CC BY-SA 4.0

Nope, 10.8.0.0/24 doesn't fall into 10.0.0.0/16. AWS is correct, sorry :)

In your 10.0.0.0/16 you can create subnets between 10.0.0.0/24 to 10.0.255.0/24, e.g. 10.0.8.0/24 would work.


Let's say we've got CIDR address 10.20.30.40 - that can fall for example into these subnets:

  • 10.0.0.0/8 - /8 means only the first byte (10.) in the address is the network address.
  • 10.20.0.0/16 - /16 means the first two bytes (10.20.) are network.
  • 10.20.30.0/24 - /24 means the first three bytes (10.20.30.) are network.
  • 10.20.30.40/32 - /32 covers the whole address (10.20.30.40) and sometimes this notation is used to explicitly say it's a host address. AWS uses that a lot.

Hope that helps :)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-12-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。