AWS · Advanced Networking Specialty

网络课程笔记

Lecture 009 · 7 张幻灯片

幻灯片、双语总结及 Transcript · 图片已内嵌,可离线阅读。

原文默认收起
lecture-009.md

Lecture 9: VPC Addressing (CIDR)

  • 课程:[NEW] AWS Certified Advanced Networking Specialty 2026
  • 视频时长:19:48
  • 来源:Udemy Lecture 24111926
  • Slide 数量:7
  • 画面切换:约 00:28、03:38、06:26、08:20、13:57、17:40

扫描说明

按页面英文 transcript 的 290 个时间点逐一定位并检查视频画面,并对画面差异较大的时间点进行复核。相同幻灯片中的项目、二进制位和白板标注逐步出现均视为动画或连续推导,合并到对应小节中。

Transcript 来自 Udemy 页面自带的英文自动字幕,没有使用 ASR。下面保留页面原文,包括其中的语法或识别错误。

1. VPC CIDR

时间范围:00:00–00:28

VPC CIDR title

总结 / Summary

中文

本节引出 VPC 的无类别域间路由(Classless Inter-Domain Routing, CIDR)地址规划。CIDR 是定义 VPC 网络边界和可用地址范围的基础。

English

This section introduces Classless Inter-Domain Routing (CIDR) as the addressing method used to define a VPC network boundary and its available address range.

Transcript

00:00 Hi.

00:00 So now let's get into the details of the first component that is Sidr.

00:06 This is how we address our VPC and believe me, most of the people find it most confusing thing to understand.

00:13 But after this lecture, I'm sure you will feel much confident about the VPC.

00:19 Cidrs.

00:21 So very first thing before we understand VPC Sidr is understanding the IP addresses.

2. IPv4 and IPv6 Addresses

时间范围:00:28–03:38

IPv4 and IPv6 addresses

总结 / Summary

中文

互联网协议地址(Internet Protocol address, IP address)用于标识网络中的主机。IPv4 地址(IPv4 address)为 32 位,通常由四个八位组(octets)以点分十进制表示;IPv6 地址(IPv6 address)为 128 位,拥有远大于 IPv4 的地址空间。课程通过二进制(binary)转换说明每个 IPv4 八位组如何表示十进制数值。

English

An Internet Protocol (IP) address identifies a host on a network. IPv4 addresses contain 32 bits and are commonly written as four decimal octets, whereas IPv6 addresses contain 128 bits and provide a vastly larger address space. The lecture also reviews how each IPv4 octet maps between decimal and binary representation.

Transcript

00:28 So I'm sure you understand the IP address scheme.

00:31 So there are two types of the IP addresses IPv4 and IPv6 addresses.

00:37 Now so far IPv4 addresses were sufficient.

00:40 But with the advent of Internet of Things, IoT and so many other applications and massive digital transformation,

00:51 we know that we are exhausting the IPv4 address range.

00:54 And that's where now IPV six range has been introduced, which is much, much larger than IPV four address

01:03 range.

01:03 And for foreseeable future, we can't exhaust IPV six addresses because they are 128 bit in length as

01:11 opposed to IPV four addresses, which are just 32 bit in length.

01:16 Okay, let's start with the IP.

01:18 Why you need IP.

01:19 So IP is Internet protocol, and every machine on the internet should have the IP address so that we

01:27 can reach to it.

01:28 Right.

01:29 So IP address is an identity of the host in the network.

01:33 Now as I said there are two types of the IP addresses IPV four which is 32 bit in size.

01:41 And then IPV six address is 128 bit in size.

01:45 Now every bit represents the power of two.

01:49 That means for IPv4 addresses we have two raised to 32 those many IP addresses available.

01:56 And for IPV six it is two raised to 128.

02:00 So in this lecture we will mainly focus on IPv4 addresses because it's easier to demonstrate.

02:06 But same logic applies for IPv6 addresses as well.

02:11 So just a quick refresher on IPV four addresses how they are represented.

02:16 So you know that there are 32 bit.

02:19 So in that there are four octets.

02:22 So here you see 12.34.56.67.

02:27 So there are four eight bits.

02:29 And every eight bit octet has been separated by a dot.

02:34 Right.

02:34 So it ultimately represents the decimal value of that octet.

02:39 So for example if you have an IP address 192.168.56.212.

02:47 In that case, if you want to represent that as a 32 bit, then you would have to convert it into the

02:54 binary as an each octet.

02:56 And then you can see the binary value of that.

02:59 So 192 can be represented in a binary.

03:03 As you know this calculations you have to turn on the bits which makes 192.

03:09 So bit number seven and bit number six.

03:12 And if you look at the binary then it should look something like this.

03:17 So that's 192.

03:19 Similarly you can have 168.

03:23 56 and two and two.

03:26 So this is just a binary representation of the IPv4 address.

03:31 So as I said, maybe in the college days or before that you might have learned different addressing

3. CIDR – Classless Inter-Domain Routing

时间范围:03:38–06:26

CIDR prefix and host bits

总结 / Summary

中文

无类别域间路由(Classless Inter-Domain Routing, CIDR)取代了传统 A、B、C 类地址方案。CIDR 由基地址(base address)和前缀长度(prefix length)组成,例如 /16 表示前 16 位固定为网络位(network bits),其余 16 位作为主机位(host bits)。前缀越长,可用于主机的位越少,网络内可用的总地址数也越小。

English

Classless Inter-Domain Routing (CIDR) replaces the older Class A, B, and C addressing model. A CIDR consists of a base address and a prefix length. For example, /16 fixes the first 16 bits as network bits and leaves the remaining 16 as host bits. A longer prefix leaves fewer host bits and therefore defines a smaller address range.

Transcript

03:38 scheme.

03:38 And that was address of class A, class B or class C.

03:43 So if you talk about class A address first octet used to be reserved for network addressing.

03:49 And rest of the three octets were reserved for the host addressing in that network.

03:55 Similarly, different combinations for class B and class C type of the addresses.

04:00 But now this scheme has been replaced with the Sidr.

04:04 And in case of Sidr, you have the base address and you have something called prefix.

04:11 So here 192.168.0.0 is a base address and slash 16 is the Sidr prefix.

04:22 But what is this slash 16 and what does it mean.

04:25 So let's try to decode that.

04:28 So this is the Cidr notation.

04:30 And now if you represent that as an binary IP address then we just learned that you can convert every

04:38 octet into binary.

04:39 And this is how it will look.

04:41 So there are 32 bits.

04:43 And we are saying the Sidr prefix is 16.

04:47 So what.

04:48 It means that 16 bit we are locating to the network address and rest of the 16 bit out of 32 we are

04:58 allocating for the host addressing inside that network.

05:02 So this 16 prefix tells us how many bits we are allocating for the network.

05:09 So network address is this.

05:11 And within that network you have this many hosts.

05:15 So if you create a VPC then this is a network address.

05:20 And individual host can receive any of the IP address from this range.

05:25 What that means is for the VPC, 192.168 is a fixed address.

05:33 And then as you go on creating the host inside the VPC, that means EC2 machine.

05:39 Then every machine will receive the IP address from the range 0 to 2, 55, and 0 to 255.

05:48 And shortly we will see with the whiteboarding how this addresses can be allocated to the different

05:54 hosts and how many IP addresses you can have inside a VPC when you create that VPC with this kind of

06:01 Sidr range.

06:02 But from this slide, I want you to understand that whatever prefix you mention, those many bits are

06:09 allocated to the network and you can't change that.

06:12 But rest of the bits which are available to you can be used for individual IP addresses inside that

06:20 network, and those can be assigned to the host.

4. Whiteboarding the /16 Address Range

时间范围:06:26–08:20

CIDR whiteboarding introduction

总结 / Summary

中文

课程以 10.10.0.0/16 为例开始白板推导(whiteboarding)。/16 固定前两个八位组,后两个八位组可以变化,因此地址从 10.10.0.0 延伸到 10.10.255.255。地址数量可用公式 2^(32−前缀长度) 计算,即 2^16 = 65,536。

English

Using 10.10.0.0/16, the whiteboard walkthrough shows that the first two octets remain fixed while the last two can vary. The range therefore extends from 10.10.0.0 to 10.10.255.255. Its size is calculated as 2^(32 − prefix length), or 2^16 = 65,536 addresses.

Transcript

06:25 Let's say an example.

06:27 I have a VPC and now in this VPC I give some address.

06:33 So this is why VPC I give it address ten dot ten .0.0 slash 16.

06:39 Now as I said, when you create a VPC with this address range out of this network address, first 16

06:47 bits are given to the network.

06:49 This 16, which is the prefix that means for this VPC.

06:52 I cannot change this for any of the host, which I'm going to launch inside this VPC.

06:57 What I can change is only this two octets, right?

07:01 So if you see the first address in this VPC will be ten .10.0.0.

07:08 Now I can change only this part.

07:11 So the next address will be ten .10.0.10.20.3.

07:17 Likewise, maybe up to 255, because we are talking about IPV four addresses and this is one octet,

07:25 right?

07:25 Eight bits.

07:26 Now my addresses does not stop here.

07:30 Once I'm done, I will again write ten dot ten dot now 255 is done.

07:36 So I need to increment this bit now, so I'll make it 1.0 again.

07:41 I continue 1.11.21.3.

07:44 Likewise my.

07:47 Address here would be ten .10.1.255.

07:52 Does my address end here?

07:55 Not really.

07:56 Right.

07:56 I can now go on incrementing this bit again.

08:00 The next address would be ten dot ten .2.02.12.2.

08:07 Likewise 2.2 55.

08:11 So that means I can go on increasing this bit now after every 256 addresses.

08:16 So how many addresses I have in this network.

5. Dividing a VPC into /24 Subnets

时间范围:08:20–13:57

CIDR calculation for multiple slash 24 subnets

总结 / Summary

中文

VPC 的 CIDR 块(CIDR block)必须先划分为子网(Subnets)才能放置 EC2 实例。将 10.10.0.0/16 划分为 /24 子网时,每个子网保留 8 个主机位,因此包含 256 个地址;示例依次形成 10.10.0.0/24、10.10.1.0/24、10.10.2.0/24 等互不重叠的子网。VPC 最多可由 256 个这种大小的地址块覆盖。

English

A VPC CIDR block is divided into subnets before EC2 instances can be placed in it. Splitting 10.10.0.0/16 into /24 subnets leaves eight host bits in each subnet, producing 256 addresses per subnet. The resulting non-overlapping ranges include 10.10.0.0/24, 10.10.1.0/24, 10.10.2.0/24, and so on, with 256 such blocks covering the original /16.

Transcript

08:20 So I have 256 in every block.

08:23 Likewise I have 256 blocks.

08:26 So 256 into 256 which is 65536.

08:32 Now you can make the same calculations here itself.

08:35 When you create a VPC with this Sidr 16 bit you are giving to the network, that means rest how many

08:44 bits you have for the host addressing 32 -16, which is 16 address bits you have for the host.

08:51 So total number of hosts you can have in this network is two raised to 16, which is again 65536.

09:00 It's as simple as that.

09:02 So the formula is whenever you see some Sidr for example.

09:06 Now let's take another example ten dot 100 .0.0 slash 24.

09:13 If you see this sidr and someone asks you how many IP addresses would be there in this Sidr.

09:19 So just look at this number 24.

09:22 That means this many bits are reserved for my network.

09:25 I only have 32 -24 equal to eight bits available for my host addressing.

09:31 So total number of host I can have is two raised to eight.

09:36 That is 256.

09:37 That means as big this Sidr is, the smaller your network is, because those many bits you are reserving

09:45 for the network and rest of the bits are available for host addressing.

09:50 So I hope this is somewhat clear.

09:53 Now let's dig it further.

09:54 Again.

09:55 Let's see we I have a VPC right.

09:58 And.

10:01 Similar address ten .10.0.0 slash 16.

10:06 But as I said, when you create a VPC, you can't use it as it is.

10:10 You need to first create subnets if you want to launch a EC2 instance within that VPC.

10:16 Now what I decide is I need a subnet, and every subnet that is a smaller network within VPC should

10:23 be of size 256 each.

10:26 So excuse my drawing here, but my first subnet should have 256 addresses.

10:33 So let me just write down those addresses.

10:36 So first address of course the range from which the VPC starts.

10:41 Then ten .0.012 up to 255.

10:47 Now this is my first subnet.

10:48 My second subnet would be ten dot ten .1.0.

10:53 So this is exactly same what we did earlier.

10:56 But just we are now calling it as one different subnet than the other.

11:01 Likewise it would have 255 I can just go on.

11:06 Adding more subnets.

11:07 So the next subnet would be ten .1.2.0.

11:11 And then it would have up to 255 256 total IP addresses.

11:16 Right now, if I want to write a Cidr notation for this subnet, you can very well write the first.

11:23 Always write the first starting address there that is ten .1.0.0.

11:29 And then understand how many IP addresses are there 256 256 means two raised to eight.

11:36 So for host we have eight eight bits.

11:38 That means we are giving 24 bits to the network.

11:42 So.

11:43 My subnet Cidr will be ten .0.0.0.

11:47 That is starting address slash 24.

11:50 And you can, uh, very well uh, cross verify this.

11:53 If you look at this whole IP address range, this three bits are not changing.

11:58 So the three octets are not changing for this subnets.

12:00 They are fixed.

12:01 And that's where it's 24.

12:03 Only this part is changing.

12:05 That is eight bits.

12:06 And ultimately you can make the same calculation 32 -24 given to the network eight bits are for host

12:13 addressing.

12:13 So total number of host equal to two raised to eight equal to 256.

12:19 Right now the same for this subnet.

12:21 This subnet starts at this address.

12:23 So we need to write a Cidr ten .10.1.0.

12:28 Right.

12:28 Which is my starting address.

12:30 Now again this subnet is of size 256.

12:32 So you need to write a prefix of 24 again.

12:37 So now this is my second subnet.

12:39 Similarly my third subnet would be ten .1.2.0 slash 24.

12:45 Likewise I have many such subnets and my last subnet would be ten dot ten dot here 250 5.0 slash 24.

12:58 Now again I have 256 size of each subnet and 256 such subnets.

13:05 So again the total size is 256 into 256 which is 6553 sorry three six.

13:13 Right.

13:14 And the same calculation you can do that from the VPC out of 32 bits I am giving 16 to the network.

13:22 So I have 16 for my host addressing within that VPC.

13:25 So total addresses 655 uh three six.

13:30 Right.

13:30 Exactly.

13:31 Same.

13:31 So it really depends on us how we divide this VPC into form of subnets.

13:36 It's not necessary that you always create subnet of size 24.

13:39 You can very well create a bigger subnet with say 23 or 20 2 or 21 or even the 16.

13:47 So you can very well just create one VPC, right, which has an address range, say ten dot ten .0.0

6. Single-Subnet and /28 Examples

时间范围:13:57–17:40

CIDR calculation for one subnet and slash 28 subnets

总结 / Summary

中文

子网大小由设计需求决定,并不必须是 /24。一个子网可以与整个 VPC 使用相同的 /16 范围,也可以使用 AWS VPC 支持的最小 IPv4 子网前缀 /28。/28 保留 4 个主机位,每个子网包含 16 个地址,因此地址边界按 16 递增,例如 10.10.0.0–10.10.0.15、10.10.0.16–10.10.0.31。

English

Subnet size is a design choice and is not limited to /24. A single subnet can use the full /16 range of its VPC, or smaller subnets can use the minimum IPv4 subnet prefix supported in an AWS VPC, /28. A /28 leaves four host bits and contains 16 addresses, so its boundaries increase in blocks of 16, such as 10.10.0.0–10.10.0.15 and 10.10.0.16–10.10.0.31.

Transcript

13:56 slash 16 and I.

13:58 And then you can say I don't want to create multiple subnet.

14:01 I'm sure that I just need one subnet in in this VPC.

14:04 Uh, I can't think of the use case, but just let's imagine and then I can just create one subnet.

14:11 So right insert this say subnet A.

14:13 And I can have the same IP address range as my VPC now which means this subnet starts from this address.

14:22 And this subnet ends at this address.

14:26 And there is no other subnet because we just created one subnet right now.

14:31 That's interesting.

14:32 Right.

14:32 That means it's up to you how many subnets you want as long as you do not reach the VPC limit.

14:39 Now let's take one more example.

14:41 And with that I'm sure, uh, the Cidr will be much clearer.

14:45 Uh, so again the same example we have VPC with say ten .10.0. 16.

14:51 Now this time I want to create even the smaller subnets.

14:54 I don't want subnet of size 256 as I want subnet as small as I can because then I want to create many,

15:01 many subnets, not just 256.

15:03 Right.

15:04 So the smallest subnet you can create inside VPC is with slash 28 prefix.

15:09 Right.

15:10 And why.

15:10 So I'll talk about that.

15:11 But let's understand if you are creating subnet of size now uh with prefix slash 28 how many IP addresses

15:19 you would have again in the subnet.

15:22 Uh 32 -28 which is four bits.

15:24 So two raise to four two raise to four equal to 16 hosts or IP addresses you can have in this subnet.

15:32 That means my first uh subnet.

15:38 Sidr would be this.

15:40 This is slash, and the first address would be this .1.2.

15:45 Now, how long it will go?

15:48 Look at the number of, uh, IPS.

15:50 The subnet would have only 16 IP addresses and we started at zero.

15:55 That means the last IP address in this subnet would be this.

15:58 So it will start at ten .10.0.0.

16:03 And it will end at ten dot ten .0. 15.

16:06 Now that's my subnet right.

16:08 Because I'm creating a smaller subnet.

16:10 Now what would be the next subnet again ten dot ten dot after this.

16:15 Right.

16:16 Zero dot 16.

16:18 Now next subnet would start here again prefix slash 28.

16:22 It will go on like this 1718.

16:26 And of course again it would have 16 IP addresses total.

16:29 So ten dot ten .0. 31.

16:33 Now this would be the last IP address in this subnet.

16:36 Right.

16:37 So now my subnet ends here.

16:39 Likewise now you're creating a smaller subnet right.

16:42 And then how many subnets you can create.

16:45 You know total IP address in this VPC is this.

16:48 And every subnet is of size 16.

16:50 So whatever number it comes those many subnets you can create uh and you can go on as long as you hit

16:57 the last uh address in this VPC.

16:59 That is ten dot ten .255.255.

17:05 Right.

17:06 So with that, I hope if given any sidr, you can very well make out, um, what how many IP addresses

17:15 will be there in that network?

17:17 And when you create a network with slash 28, you have to raise to four equal to 16 IP addresses.

17:23 If it's say 27, it's two raised to five, that is 32.

17:27 Similarly, if it's 26 then two raised to six equal to 64.

17:33 So all this calculation you can now easily make.

17:37 So uh let's try to solve this.

7. Understanding CIDRs – Exercise

时间范围:17:40–19:48

CIDR calculation exercise

总结 / Summary

中文

练习使用 2^(32−前缀长度) 快速计算 CIDR 地址数量:/24 有 256 个地址,/16 有 65,536 个地址,/32 只精确表示一个 IPv4 地址。0.0.0.0/0 的前缀长度为 0,会匹配所有 IPv4 地址,常见于需要面向整个互联网开放的防火墙规则(firewall rules)。

English

The exercise applies 2^(32 − prefix length) to common CIDRs: /24 contains 256 addresses, /16 contains 65,536, and /32 identifies exactly one IPv4 address. The prefix 0.0.0.0/0 matches every IPv4 address and commonly appears in firewall rules intended to allow access from the entire Internet.

Transcript

17:39 If you have the IP address range 19216800 slash 24 again 24.

17:45 That means 32 minus right 32 -24 equal to eight bits for the host.

17:52 So two raised to eight equal to 256 IP addresses I would have.

17:56 It will start with ..0.

17:58 It will add it dot 255.

18:01 This is what we just understood.

18:03 Slash 16.

18:04 Of course you would have 65536.

18:07 That is 16 -16.

18:08 That is 16 bits available for the host addresses two raised to 16.

18:12 Is this number.

18:13 Now this is interesting.

18:15 134 5678 123 slash 32 now make the same calculation 32 -32 equal to zero.

18:24 So two raised to zero equal to one.

18:26 That means in this network I can have only one IP address.

18:29 And it is itself right.

18:31 This the same IP address which is given here.

18:34 So that's that's what the slash 32 means.

18:38 So if you want to specify a single IP address using the Sidr notation it would have slash 32.

18:44 Similarly 0000/0 is interesting.

18:47 This means all IP address.

18:49 You are not reserving anything for the network right.

18:52 So anything on the internet can be, uh, really matched with this IP address.

18:57 So typically you will see in the security groups whenever you configure um, uh, firewall rules.

19:04 And if you want to open that port for the whole world, like for example port 80, that is Http, you

19:09 want to open for whole world, you will open the source IP as 0000.

19:16 That means any IP it can match.

19:18 Right.

19:18 So remember this, uh, and if you want to make your calculation and make your life easy, you can go

19:23 ahead and check this website.

19:25 Uh, and you can just enter your Cidr range and it will exactly show you which IP addresses, uh, will

19:31 be there in that, uh, given Sidr.

19:34 But I hope with this explanation you can make out, uh, on your own.

19:39 So that's it about the VPC Sidr.

19:41 And now let's look into the other components of the VPC.

19:45 Thanks for watching and stay tuned.

整讲总结 / Overall Summary

中文

无类别域间路由(Classless Inter-Domain Routing, CIDR)用“基地址 + 前缀长度”同时描述网络边界和规模。IPv4 网络包含 2^(32−前缀长度) 个地址;前缀越长,网络越小。VPC CIDR 可以按需求划分为多个不重叠的子网 CIDR,理解网络位(network bits)、主机位(host bits)、块大小和边界递增规律,是规划 VPC 地址空间的基础。

English

Classless Inter-Domain Routing (CIDR) describes both a network boundary and its size through a base address and prefix length. An IPv4 CIDR contains 2^(32 − prefix length) addresses, so a longer prefix defines a smaller network. A VPC CIDR can be divided into multiple non-overlapping subnet CIDRs; understanding network bits, host bits, block size, and boundary increments is fundamental to VPC address planning.

返回顶部 ↑