Setting up a VPC with Subnets: Configuring NTP Server for EC2 Instances

How to Set Up a VPC with Subnets to Configure NTP Server for EC2 Instances

Prev Question Next Question

Question

You are planning to set up a VPC with Subnets.

The EC2 Instances hosted in the VPC need to get the time from a custom NTP server.

How can you accomplish this?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - A.

You can create new DHCP options set and then provide the NTP server name as part of the options set.

Below is from the AWS Documentation which shows the configuration possible in the DHCP options set.

All other options are invalid as the configurations mentioned are invalid.

For more information on the DHCP Options Set, please refer to the below URL.

https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html
DHCP Option Nam

domain-name-servers

domain-name

ntp-servers

netbios-name-servers

netbios-node-type

The IP addresses of up to four domain name servers, or AmazonProvidedDNS. The default DHCP option set specifies
AmazonProvidedDNS. If specifying more than one domain name server, separate them with commas. Although you can
specify up to four domain name servers, note that some operating systems may impose lower limits.

If you want your instance to receive a custom DNS hostname as specified in domain-name, you must set domain-name-
servers to a custom DNS server.

If you're using AmazonProvidedDNS in us-east-1, specify ec2.internal. If you're using AmazonProvidedDNS in another
region, specify region.compute.internal (for example, ap-northeast-1.compute.internal). Otherwise, specify a domain
name (for example, example.com). This value is used to complete unqualified DNS hostnames. For more information
about DNS hostnames and DNS support in your VPC, see Using DNS with Your VPC.

Important

Some Linux operating systems accept multiple domain names separated by spaces. However, other Linux operating
systems and Windows treat the value as a single domain, which results in unexpected behavior. If your DHCP options
set is associated with a VPC that has instances with multiple operating systems, specify only one domain name.

2132.

The IP addresses of up to four NetBIOS name servers.

The NetBIOS node type (1, 2, 4, or 8). We recommend that you specify 2 (point-to-point, or P-node). Broadcast and
multicast are not currently supported. For more information about these node types, see section 8.7 of RFC 2132 and
section 10 of RFC1001

To set up a VPC with subnets and enable EC2 instances to get the time from a custom NTP server, the best approach is to create a DHCP Options set and provide the NTP server name. This option is available in answer choice A.

Here's why:

DHCP (Dynamic Host Configuration Protocol) is a network protocol used to dynamically assign IP addresses and other network configuration parameters to devices connected to a network. When an EC2 instance boots up, it sends a DHCP request to obtain an IP address and other network configuration parameters, such as the DNS server and the NTP server.

By creating a DHCP Options set, you can specify custom DHCP options that are not available by default. One of these options is the NTP server. When an EC2 instance obtains its network configuration from the DHCP server, it will also receive the NTP server information, which it can then use to synchronize its clock.

To create a DHCP Options set with the NTP server information, follow these steps:

  1. Open the Amazon VPC console.
  2. In the left navigation pane, choose DHCP options sets.
  3. Choose Create DHCP options set.
  4. In the Name tag field, enter a name for the DHCP options set.
  5. In the NTP servers field, enter the IP address or hostname of the custom NTP server.
  6. Choose Create DHCP options set.

Once you have created the DHCP Options set, you need to associate it with your VPC. To do this, follow these steps:

  1. In the Amazon VPC console, choose Your VPCs.
  2. Select the VPC that you want to associate with the DHCP options set.
  3. Choose Actions, and then choose Edit DHCP options set.
  4. Select the DHCP options set that you created earlier.
  5. Choose Save.

With the DHCP options set in place, any new EC2 instance that is launched in the VPC will automatically receive the NTP server information as part of its network configuration.

Answer choice B, defining a resource record in Route 53 and providing the NTP server name, is not the best option for this scenario because Route 53 is a DNS service, not a DHCP service. While you can use Route 53 to define a DNS record for the custom NTP server, this will not provide the necessary information to the EC2 instances to synchronize their clocks.

Answer choice C, assigning the NTP server in the subnet configuration, is not a valid option. While you can configure the subnet to use a specific NTP server, this will not automatically provide the necessary information to the EC2 instances.

Answer choice D, using an Application Load Balancer and then providing the NTP server as part of the ALB configuration, is also not a valid option for this scenario. An Application Load Balancer is used for distributing traffic across multiple targets, and it does not provide DHCP or NTP services.