Lecture 32: VPC DHCP Option sets
- 课程:[NEW] AWS Certified Advanced Networking Specialty 2026
- 视频时长:14:27
- 来源:Udemy Lecture 26072538
- Slide 数量:16
- 画面切换:00:16、02:06、02:26、03:41、04:05、04:53、06:29、08:00、08:20、09:24、09:32、10:05、11:37、12:47、13:02
扫描说明
按 Udemy Transcript 的 191 个时间点逐一定位并比较视频画面,确认 8 个正式 Slide;中间 AWS 控制台与终端演示再按教学目标拆为 8 个稳定阶段,共 16 小节。动画构建保留最终状态,所有截图均取完整视频内容区域。
Transcript 来自 Udemy 页面自带的英文自动字幕,没有使用 ASR。下面保留页面原文,包括其中的语法或识别错误。
1. VPC DHCP Option Sets
时间范围:00:00–00:16
总结 / Summary
中文
本讲聚焦 VPC 的 DHCP 选项集(DHCP Option Set),以及其中会影响 VPC DNS 配置(DNS Configuration)的属性。每个 VPC 都会获得一个默认选项集。
English
This lecture focuses on VPC DHCP option sets and the attributes that affect VPC DNS configuration. Every VPC receives a default option set.
Transcript
00:00 Hi.
00:01 So in this lecture let's understand how Dhcp option sets work and what kind of attributes it has which
00:07 affects your DNS configuration for the VPC.
00:11 So as I said every VPC comes with a default Dhcp option set.
2. DHCP Option Set Attributes and Defaults
时间范围:00:16–02:06
总结 / Summary
中文
DHCP 选项集(DHCP Option Set)通过动态主机配置协议(Dynamic Host Configuration Protocol, DHCP)向实例提供域名、域名服务器(Domain Name Server)、网络时间协议服务器(NTP Server)和 NetBIOS 参数。默认域名服务器为 AmazonProvidedDNS,也就是 Route 53 解析器(Route 53 Resolver);选项集在实例启动时自动生效,也可以把 DNS 查询改指向自定义服务器。
English
A DHCP option set supplies instances with the domain name, domain-name servers, Network Time Protocol servers, and NetBIOS settings. AmazonProvidedDNS—the Route 53 Resolver—is the default name server. The settings are applied automatically when instances launch and can instead point DNS queries to a custom server.
Transcript
00:16 And it provides basically a dynamic host configuration protocol attributes for the VPC resources.
00:23 So through Dhcp option set you can set what should be the private domain name for your EC2 instances.
00:31 Then what should be the domain name server which is like route 53 resolver by default.
00:37 Then additional thing like network time protocol server that is NTP and net bias node type.
00:43 But out of this I think we are interested mainly in domain name server.
00:48 Because using the Dhcp option set, we can tell your VPC that do not look at the AWS provided DNS server,
00:55 but rather you can look at some other DNS server for resolving the DNS queries.
01:00 And we will do that exercise little later in this section.
01:05 But all these configurations are managed at the VPC level using the Dhcp option sets.
01:11 So as I said, when you launch the EC2 instances, this Dhcp option set parameters are automatically
01:19 applied for the EC2 instances as you launch them.
01:23 So it has the default domain name server which points to Amazon provided DNS, which is nothing but
01:30 the route 53 DNS resolver that we talked about in the last lecture.
01:36 And it also automatically configures the internal domain name for your EC2 machines.
01:43 So the typical format is private IP of the EC2 instance, then the region name and then compute dot
01:50 internal.
01:51 And we are going to again talk about this in further detail.
01:55 But overall this is what Dhcp option set does.
01:59 So I hope that is clear.
02:01 Now just to show you this is one of the Dhcp option set which is a default one.
3. Inspecting the Default DHCP Option Set
时间范围:02:06–02:26
总结 / Summary
中文
默认 DHCP 选项集(Default DHCP Option Set)是区域相关的:示例位于 Mumbai 区域,因此域名为 ap-south-1.compute.internal,名称服务器为 AmazonProvidedDNS。该选项集自动与 VPC 关联。
English
The default DHCP option set is Region-specific. In the Mumbai example, the domain is ap-south-1.compute.internal and the name server is AmazonProvidedDNS. The option set is automatically associated with the VPC.
Transcript
02:06 And you can see here that it is created in Mumbai region.
02:10 And that's where the domain name is AP South one dot compute dot internal.
02:15 And the default domain name server is Amazon provided DNS.
02:20 And this Dhcp option set is automatically associated with your VPC.
4. How DHCP Configures Hostnames and resolv.conf
时间范围:02:26–03:41
总结 / Summary
中文
DHCP 会为 EC2 实例设置私有主机名(Private Hostname),并在 Linux 中配置 /etc/resolv.conf。其中名称服务器指向 VPC 网络地址加 2(VPC base address + 2,例如 10.10.0.2),搜索域(Search Domain)来自 DHCP 选项集;是否分配公有主机名还受 VPC DNS 属性控制。
English
DHCP assigns private hostnames to EC2 instances and configures /etc/resolv.conf on Linux. The name server points to the VPC network address plus two, such as 10.10.0.2, while the search domain comes from the DHCP option set. Public-hostname assignment is additionally controlled by VPC DNS attributes.
Transcript
02:26 And then as you launch EC2 instances they will have corresponding private DNS name something like this.
02:34 So what it does basically it sets the host name for your EC2 instances.
02:39 Now this host names could be private host names or the public host name.
02:44 Now it really depends on the DNS attribute where your EC2 instance will also receive the public hostname
02:51 or not.
02:51 But there are always this private host names.
02:54 So it sets up the host name which is in a format like IP address, dot region, dot computing internal.
03:02 And additionally the Dhcp will also set the Resolv.conf.
03:07 If it's a Linux machine which tells your EC2 instance, what is the name server for DNS resolution?
03:14 And here if you see the cursor, it has the name server 10.10.0.2, which is nothing but VPC base address
03:22 plus two.
03:23 That means all the DNS queries from the EC2 instance are going to this name server.
03:28 And we already talked about this DNS server in detail in the earlier lecture, so I hope that is clear.
03:35 Now with that, let me take you to the AWS console and show you some of these configurations.
5. VPC Association and Default DNS Values
时间范围:03:41–04:05
总结 / Summary
中文
控制台中的 Demo VPC 关联默认 DHCP 选项集(Default DHCP Option Set)。检查关联对象可以看到区域内部域名和 AmazonProvidedDNS,本示例没有修改这些默认值。
English
The Demo VPC is associated with its default DHCP option set. Inspecting that association shows the Region-specific internal domain and AmazonProvidedDNS; no defaults were changed in this example.
Transcript
03:41 So I just created one VPC called demo VPC.
03:44 And if you see here it is associated with Dhcp option set which is the default one.
03:50 And if you just go to this Dhcp option set then you will see the domain name as this.
03:56 And the name server is Amazon provided DNS.
04:00 And for this VPC I did not make any changes to the default Dhcp option set.
6. Private DNS and the Initially Missing Public DNS Name
时间范围:04:05–04:53
总结 / Summary
中文
公有子网(Public Subnet)中的实例与私有子网(Private Subnet)中的实例都会获得私有 IPv4 DNS 名称(Private IPv4 DNS Name)。即使实例拥有公有 IP,也可能没有公有 DNS 名称(Public DNS Name),因为其分配还取决于 VPC 的 enableDnsHostnames 属性。
English
Instances in both public and private subnets receive private IPv4 DNS names. Even an instance with a public IP can initially lack a public DNS name because that assignment also depends on the VPC enableDnsHostnames attribute.
Transcript
04:05 What I did is I just went to the EC2 and I launched two instances this instance one and instance 2 in
04:13 2 different subnets.
04:15 Now instance one has a public IP because it's in a public subnet, and instance two is in a private
04:22 subnet.
04:24 Now if you look at the instance one, it has the public IP and it has a private IP.
04:29 Now along with this private IP it also has a private DNS name which is assigned by this Dhcp.
04:37 But if you notice there is no public DNS name for this EC2 instance.
04:42 Now that's for the reason that there is a setting at the VPC level, which tells whether the EC2 instance
04:49 with the public IP will receive the public DNS or not.
7. Enabling DNS Hostnames and Verifying a New Instance
时间范围:04:53–06:29
总结 / Summary
中文
enableDnsSupport 允许 VPC 使用 Amazon 提供的 DNS 解析(DNS Resolution),而 enableDnsHostnames 控制具有公有 IP 的实例是否获得公有 DNS 主机名(Public DNS Hostname)。启用后,新启动到公有子网的实例会同时获得公有 IP 和公有 DNS 名称;现有实例不会因为属性变化自动重新生成相同的启动流程。
English
enableDnsSupport allows the VPC to use Amazon-provided DNS resolution, while enableDnsHostnames controls whether instances with public IPs receive public DNS hostnames. After enabling it, a newly launched instance in a public subnet receives both a public IP and a public DNS name.
Transcript
04:53 So if we go back to our VPC and just go here and look at this VPC attributes.
05:00 So this first parameter enabled DNS resolution tells VPC that it can resolve the DNS using the Amazon
05:07 provided DNS server.
05:08 And the second attribute which is enable DNS host names.
05:11 It basically control whether the EC2 instance will receive the public IP or not.
05:16 So let's just enable this and save it.
05:25 But now, if we launch another instance in a public subnet with the public IP, it should also receive
05:31 the public DNS.
05:33 So let's quickly do that.
05:35 And while we wait for that instance we will also see some other things.
05:40 So let me quickly launch this instance and let's make sure that it is in our VPC.
05:46 And it is launched in a public subnet and it has a public IP.
05:51 Rest of the settings I'm keeping mostly as default and launching this instance.
05:57 Okay.
05:57 So it will take some time for this instance to be launched.
06:00 Okay.
06:01 Now if we come back here and see that there is this instance one and it automatically got its public
06:07 IP.
06:07 Now because we have enabled this setting at the VPC level that is enabled DNS hostname.
06:12 And for the instance three it also got this public IP.
06:18 Now we also have instance two which is in private subnet.
06:22 And it just has a private IP.
06:24 Now what we want to quickly do is from any of these instance one or instance three.
8. Resolving Private and Public EC2 Names Inside the VPC
时间范围:06:29–08:00
总结 / Summary
中文
从 VPC 内的实例查询另一台实例的私有 DNS 名称(Private DNS Name)会返回其私有 IP。更重要的是,从 VPC 内查询 EC2 的公有 DNS 名称(Public DNS Name)也会返回该实例的私有 IP,避免同一 VPC 内的流量绕行公有路径;这些查询由 DHCP 分发的 AmazonProvidedDNS 完成。
English
From an instance inside the VPC, another instance's private DNS name resolves to its private IP. More importantly, an EC2 public DNS name queried from inside the VPC also resolves to the instance's private IP, avoiding an unnecessary public path. AmazonProvidedDNS, distributed through DHCP, performs these lookups.
Transcript
06:29 Let's try to resolve the private DNS of instance two.
06:32 And it should resolve to its corresponding private IP.
06:35 So I'm just getting the public IP address.
06:38 Or I can use public DNS as well to connect to this instance from my putty session.
06:44 Okay.
06:44 So I'm putting this DNS name I'm loading my key and just opening this session.
06:56 And you can see I am into my session now.
06:59 From here, let's try to ping to our EC2 instance two using its private DNS.
07:06 Now for that, let's go here and let's pick this private DNS and just try that.
07:13 And you can see that it is resolving to its private IP.
07:17 So this is being resolved using the Amazon provided DNS server.
07:21 And this is going through our Dhcp configurations.
07:25 Now I also want to show you one more thing.
07:27 That is what if you try to resolve the public DNS of the EC2 instance from, you know, within the EC2
07:34 instance itself.
07:35 So let's try that.
07:37 So let's get this instance three public DNS which is this.
07:43 And let's try to ping to that.
07:46 Now you see it has resolved to its private IP.
07:49 It hasn't resolved to its public IP.
07:52 Now that's because we are making the DNS queries from within the VPC.
07:56 However, if you do the same thing from your local machine.
9. Resolving the Same Public Name Outside the VPC
时间范围:08:00–08:20
总结 / Summary
中文
从 VPC 外部使用 nslookup 查询同一个 EC2 公有 DNS 名称(Public DNS Name)时,结果变为公有 IP。这个内外返回不同地址的行为体现了位置相关的 DNS 解析(Split-Horizon DNS Behavior)。
English
When the same EC2 public DNS name is queried from outside the VPC with nslookup, it resolves to the public IP. The different inside-versus-outside answer demonstrates location-dependent, split-horizon DNS behavior.
Transcript
08:00 So let me try to go to my CMD and say Nslookup.
08:08 Then you can see that it has resolved to its public IP because we are querying that from outside of
08:15 the VPC.
08:16 So that is how public DNS resolution happens.
10. Inspecting resolv.conf and the Search Domain
时间范围:08:20–09:24
总结 / Summary
中文
Linux 的 /etc/resolv.conf 显示名称服务器为 VPC+2 地址,并包含区域搜索域(Search Domain)。因此只输入主机名的前半段时,解析器会自动追加搜索后缀并完成查询;这证明 DNS 客户端设置来自 DHCP 配置。
English
Linux /etc/resolv.conf shows the VPC+2 name server and the Region search domain. A short hostname can therefore resolve after the client automatically appends the search suffix, demonstrating that the DNS client configuration came from DHCP.
Transcript
08:20 Now one more thing I want to show you is how that resolv.conf looks like.
08:26 Right?
08:26 So if you see Resolv.conf on this machine, the name server is 10.10.0.2, which is the VPC base address
08:35 plus two.
08:36 So all the DNS queries are being sent to this particular DNS server.
08:42 And this is the search domain for your EC2 instances.
08:46 Which means if you don't provide the complete DNS name, it will automatically look at this as a suffix
08:52 of your domain name.
08:53 Now what do I mean by that?
08:55 Instead of pinging to an private DNS which ends in this, you can just say, you know, the first part
09:02 of the DNS, which is this.
09:06 And if you do that, it still resolves because it is looking at this search domain.
09:11 Now again, not important for your exam, but something that you should know.
09:15 Right.
09:16 So I hope this is clear.
09:17 And you can definitely try all these scenarios on your own.
09:21 So with that, let's go back to our presentation.
11. DHCP-to-Instance Configuration Recap
时间范围:09:24–09:32
总结 / Summary
中文
回到架构图后,完整链路是:VPC 关联 DHCP 选项集(DHCP Option Set),实例获得主机名、名称服务器与搜索域,然后把 DNS 查询发送到 Route 53 解析器(Route 53 Resolver)。
English
The completed workflow is: the VPC associates a DHCP option set, instances receive hostnames, a name server, and a search domain, and their DNS queries are sent to the Route 53 Resolver.
Transcript
09:24 So we saw all these settings, and we also saw how EC2 instance gets private DNS and the public DNS.
12. AWS-Assigned Domain Name Formats for EC2
时间范围:09:32–10:05
总结 / Summary
中文
EC2 内部 DNS(Internal DNS)通常采用 ip-<private-ip>.<region>.compute.internal;us-east-1 使用较短的 ip-<private-ip>.ec2.internal。拥有公有 IP 的实例还会获得外部 DNS(External DNS),其区域化形式为 ec2-<public-ip>.<region>.compute.amazonaws.com,北弗吉尼亚使用 compute-1.amazonaws.com 变体。
English
EC2 internal DNS normally follows ip-<private-ip>.<region>.compute.internal; us-east-1 uses the shorter ip-<private-ip>.ec2.internal. An instance with a public IP can also receive an external DNS name in the form ec2-<public-ip>.<region>.compute.amazonaws.com, with the North Virginia compute-1.amazonaws.com variant.
Transcript
09:32 Just there is one difference to know that if EC2 instance is in North Virginia region, that is US east
09:39 one, then the syntax is little different, but otherwise the syntax is IP dash private IPv4 address,
09:45 dot region, dot compute, dot internal and similar domain name for the public address as well.
09:53 And we already talked about domain names, the private and the public DNS.
09:57 So I hope that is clear.
09:59 Now, one thing to note here is that you cannot modify the existing Dhcp option set, but rather you
13. Associating a New DHCP Option Set
时间范围:10:05–11:37
总结 / Summary
中文
现有 DHCP 选项集(DHCP Option Set)不能原地修改;必须创建新选项集并重新关联 VPC。示例把私有域改为 finance.internal,也可以把 AmazonProvidedDNS 换成自定义域名服务器(Custom DNS Server)。实例通常在 DHCP 租约(DHCP Lease)续订后获得新配置,也可用操作系统命令主动刷新。
English
An existing DHCP option set cannot be edited in place; create a new set and associate it with the VPC. The example changes the private domain to finance.internal, and the name server could likewise be changed from AmazonProvidedDNS to a custom DNS server. Instances normally receive the new settings when their DHCP leases renew, or an operating-system command can refresh the lease.
Transcript
10:05 would have to create a new Dhcp option set and then associate that with your existing VPC.
10:11 So something like this.
10:13 Now in here we are changing our private domain name to finance dot internal.
10:19 And once you do that the search domain for this VPC is set to finance dot internal instead of AP South
10:27 1.4. internal.
10:29 Which means now all these EC2 instances can reach to each other using the domain name, something like
10:35 IP dash, private IP address, dot finance, dot internal.
10:40 But you have to wait for a few hours.
10:42 Typically for this or otherwise, depending on your operating system, you can run some Dhcp command
10:48 to refresh your Dhcp lease.
10:51 So that's another thing that you need to note is that Dhcp option set cannot be modified.
10:57 You have to create a new one and then associate that with your VPC.
11:02 Now here we talked about changing the domain name.
11:04 But very well you can also change the name server.
11:07 So instead of using Amazon provided DNS, you can point your DNS queries to your custom domain name
11:14 server.
11:15 And we are going to see that in the hands on exercise.
11:19 So which means you can change all the parameters in Dhcp option set.
11:23 And accordingly it will affect your DNS configuration.
11:28 So I hope that is clear.
11:30 Okay.
11:30 So let's move on.
11:31 And let's again talk about the VPC DNS attributes which we already saw in our exercise.
14. VPC DNS Attributes
时间范围:11:37–12:47
总结 / Summary
中文
enableDnsSupport 默认启用,决定查询能否发送给 VPC 的 Amazon DNS 服务器;enableDnsHostnames 控制拥有公有 IP 的实例是否分配公有主机名。使用 Route 53 私有托管区域(Private Hosted Zone)时,两项属性都必须为 true,否则私有区域解析可能失败。
English
enableDnsSupport is enabled by default and determines whether queries can use the VPC's Amazon DNS server. enableDnsHostnames controls public-hostname assignment for instances with public IPs. Both attributes must be true when using a Route 53 Private Hosted Zone, or private-zone resolution can fail.
Transcript
11:37 So there are two attributes one enabled DNS support.
11:41 And the default is true.
11:42 And basically decides if the DNS resolution is supported for the VPC or not.
11:47 So if it is true, then all the DNS queries are sent to AWS DNS server at the virtual IP or say base
11:55 address plus two.
11:56 The another attribute is enabled DNS hostname, and it governs where your EC2 instance with the public
12:03 IP will receive the public DNS or not.
12:06 So by default this attribute is false, but typically you should turn it on as well.
12:12 So if true, it assigns the public hostname to the EC2 instance which has a public IP.
12:19 Now with the combination of this true, there are a lot of things that may work or may not work.
12:24 For example, if you are using Amazon Route 53 private hosted zone for managing the private DNS for
12:30 the VPC, then you should have both these attributes set to true.
12:33 If any of these is false, then it won't resolve your DNS queries.
12:38 So these are a few things which probably you should remember.
12:41 And again if you want to try, you can try this in your AWS account where you set this parameter.
15. Try It Out: Toggle enableDnsHostnames
时间范围:12:47–13:02
总结 / Summary
中文
练习建议分别在 enableDnsHostnames 未启用和启用时启动或检查具有公有 IP 的实例,比较其公有 DNS 名称(Public DNS Name)是否出现,从而直接验证该属性的作用。
English
The suggested exercise compares an instance with a public IP while enableDnsHostnames is disabled and enabled. Checking whether a public DNS name appears directly demonstrates the attribute's effect.
Transcript
12:47 And you can check that whether the EC2 instance with public IP has got the public DNS or not.
12:54 We have already seen that in our exercise.
12:57 And finally, a few things that you need to remember for your exam.
16. DHCP Option Sets: Exam Essentials
时间范围:13:02–14:27
总结 / Summary
中文
考试要点:DHCP 选项集(DHCP Option Set)不可修改,只能新建并替换;一个 VPC 同时只能关联一个选项集。VPC 可以不关联选项集,但实例将失去必要的 DNS 客户端配置;新关联可能等待数小时,取决于 DHCP 租约(DHCP Lease),Linux 可用 dhclient 等命令刷新。行为会因操作系统而异。
English
For the exam: DHCP option sets are immutable, so replacement requires a new set; a VPC can have only one associated set at a time. A VPC can have no option set, but instances then lack the client configuration needed for normal DNS resolution. A new association can take hours depending on the DHCP lease, while Linux can refresh it with a command such as dhclient; exact commands vary by operating system.
Transcript
13:02 So once you create a Dhcp option set you cannot modify the existing one, but rather you can create
13:08 a new one and associate that with the VPC.
13:11 At a given time.
13:12 You can only have one DSP option set associated with the VPC.
13:17 Now you can also have the VPC and say I don't want to have any DSP option set.
13:21 But the problem is in that case, VPC doesn't know where to send the DNS queries and it cannot resolve
13:28 then any DNS, which is okay if your instance can communicate with each other directly using the private
13:35 IP addresses.
13:36 Further, if you are changing your existing Dhcp option set and associating a new one with your VPC,
13:43 it may take a few hours to take in effect.
13:45 And it depends on your Dhcp lease.
13:48 But if you want that this take into effect immediately, then you can probably run some Linux command
13:54 for example Dhcp client and it refreshes your Dhcp lease.
14:00 So this will really depend on your operating system.
14:02 So this is for the Linux and for other operating system.
14:05 There will be different commands.
14:07 So you can refresh your Dhcp lease on demand.
14:10 Otherwise it will happen over few hours.
14:13 So these are all the important things that you should know for your exam.
14:17 And with that we will see few things in action so that you understand it completely.
14:23 So thanks for watching and stay tuned.
整讲总结 / Overall Summary
中文
本讲把 DHCP 选项集(DHCP Option Set)与 VPC DNS 的实际行为串在一起:默认集向实例分发 AmazonProvidedDNS、区域域名与搜索域;enableDnsSupport 和 enableDnsHostnames 分别控制解析能力与公有主机名;自定义 DNS 或域名需要新建并关联选项集。还通过实操验证了 EC2 公有 DNS 名称在 VPC 内返回私有 IP、在 VPC 外返回公有 IP。
English
This lecture connects DHCP option sets to actual VPC DNS behavior. The default set distributes AmazonProvidedDNS, the Region domain, and a search domain; enableDnsSupport and enableDnsHostnames control resolution and public-hostname assignment; and custom DNS or domain settings require a newly associated option set. The lab also verifies that an EC2 public DNS name returns a private IP inside the VPC and a public IP outside it.