Amazon Virtual Private Cloud
User Guide (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

DHCP Options Sets

This topic describes DHCP options sets and how to specify the DHCP options for your VPC.

Overview of DHCP Options Sets

The Dynamic Host Configuration Protocol (DHCP) provides a standard for passing configuration information to hosts on a TCP/IP network. The options field of a DHCP message contains the configuration parameters. Some of those parameters are the domain name, domain name server, and the netbios-node-type.

DHCP options sets are associated with your AWS account so that you can use them across all of your virtual private clouds (VPC).

The Amazon EC2 instances you launch into a nondefault VPC are private; they're not assigned a public IP address. By default, all instances in a nondefault VPC receive an unresolvable host name that AWS assigns (for example, ip-10-0-0-202). You can assign your own domain name to your instances, and use up to four of your own DNS servers. To do that, you must specify a special set of DHCP options to use with the VPC. This set can contain other commonly used DHCP options (see the following table for the full list of supported options). For more information about the options, see RFC 2132.

DHCP Option Name Description

domain-name

A domain name of your choice (for example, example.com).

domain-name-servers

The IP address of a domain name server. You can specify up to four addresses.

ntp-servers

The IP address of a Network Time Protocol (NTP) server. You can specify up to four addresses.

netbios-name-servers

The IP address of a NetBIOS name server. You can specify up to four addresses.

netbios-node-type

The NetBIOS node type (1, 2, 4, or 8). For more information about the values, see RFC 2132. We recommend you only use 2 at this time (broadcast and multicast are currently not supported).

Amazon DNS Server

When you create a VPC, we automatically create a set of DHCP options and associate them with the VPC. This set includes only a single option: domain-name-servers=AmazonProvidedDNS. This is an Amazon DNS server, and this option enables DNS for instances that need to communicate over the VPC's Internet gateway. The string AmazonProvidedDNS maps to a DNS server running on a reserved IP address at the base of the VPC network range "plus two". For example, the DNS Server on a 10.0.0.0/16 network is located at 10.0.0.2.

Note

You can also use the Amazon DNS server IP address 169.254.169.253, though some servers don't allow its use. Windows Server 2008, for example, disallows the use of a DNS server located in the 169.254.x.x network range.

Changing DHCP Options

After you create a set of DHCP options, you can't modify them. If you want your VPC to use a different set of DHCP options, you must create a new set and associate them with your VPC. You can also set up your VPC to use no DHCP options at all.

You can have multiple sets of DHCP options, but you can associate only one set of DHCP options with a VPC at a time. If you delete a VPC, the DHCP options set associated with the VPC are also deleted.

After you associate a new set of DHCP options with a VPC, any existing instances and all new instances that you launch in the VPC use these options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. If you want, you can explicitly renew the lease using the operating system on the instance.

Working with DHCP Options Sets

This section shows you how to work with DHCP options sets.

Creating a DHCP Options Set

You can create as many additional DHCP options sets as you want. However, you can only associate a VPC with one set of DHCP options at a time. After you create a set of DHCP options, you must configure your VPC to use it. For more information, see Changing the Set of DHCP Options a VPC Uses.

To create a DHCP options set

  1. Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.

  2. Click DHCP Options Sets in the navigation pane, and then click the Create DHCP Options Set button.

  3. In the Create DHCP Options Set dialog box, enter values for the options that you want to use, and then click Yes, Create.

    Important

    If your VPC has an Internet gateway, make sure to specify your own DNS server or Amazon's DNS server (AmazonProvidedDNS) for the domain-name-servers value. Otherwise, the instances that need to communicate with the Internet won't have access to DNS.

    Create DHCP Options Set dialog box

    The new set of DHCP options appears in your list of DHCP options. The following image shows an example of the list, with both the set of DHCP options you just created and the set that automatically came with your VPC (where the only option is domain-name-servers=AmazonProvidedDNS).

    List of DHCP options available
  4. Make a note of the ID of the new set of DHCP options (dopt-xxxxxxxx). You will need it to associate the new set of options with your VPC.

Although you've created a set of DHCP options, you must associate it with your VPC for the options to take effect. You can create multiple sets of DHCP options, but you can associate only one set of DHCP options with your VPC at a time.

Changing the Set of DHCP Options a VPC Uses

You can change which set of DHCP options your VPC uses. If you want the VPC to use no DHCP options, see Changing a VPC to use No DHCP Options.

Note

The following procedure assumes that you've already created the DHCP options set you want to change to. If you haven't, create the options set now. For more information, see Creating a DHCP Options Set.

To change the DHCP options set associated with a VPC

  1. Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.

  2. Click Your VPCs in the navigation pane.

  3. Select the VPC and click the Change DHCP Options Set button.

  4. In the Change DHCP Options Set dialog box, select a set of options from the drop-down list, and then click Yes, Change.

    List of DHCP options to associate with a VPC

After you associate a new set of DHCP options with the VPC, any existing instances and all new instances that you launch in that VPC use the options. You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. If you want, you can explicitly renew the lease using the operating system on the instance.

Changing a VPC to use No DHCP Options

You can set up your VPC to use no set of DHCP options.

  1. Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.

  2. Click Your VPCs in the navigation pane.

  3. Select the VPC and click the Change DHCP Options Set button.

  4. In the Change DHCP Options Set dialog box, select none from the drop-down list, and then click Yes, Change.

    List of DHCP options to change

You don't need to restart or relaunch the instances. They automatically pick up the changes within a few hours, depending on how frequently the instance renews its DHCP lease. If you want, you can explicitly renew the lease using the operating system on the instance.

Deleting a DHCP Options Set

When you no longer need a DHCP options set, use the following procedure to delete it. The VPC must not be using the set of options.

To delete a DHCP options set

  1. Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.

  2. Click DHCP Options Set in the navigation pane.

  3. Select the set of DHCP options to delete, and then click Delete.

    List of DHCP options to delete
  4. In the Delete DHCP Options Set dialog box, click Yes, Delete.

API and Command Overview

The following table summarizes the available DHCP options set commands and corresponding API actions.

DescriptionCommandAPI Action

Creates a set of DHCP options for your VPC.

ec2-create-dhcp-options

CreateDhcpOptions

Associates a set of DHCP options with the specified VPC, or changes the VPC to use no DHCP options.

ec2-associate-dhcp-options

AssociateDhcpOptions

Describes one or more of your sets of DHCP options.

ec2-describe-dhcp-options

DescribeDhcpOptions

Deletes a set of DHCP options.

ec2-delete-dhcp-options

DeleteDhcpOptions