Modifying the DHCP Options Set Associated with a Net

You can associate a default or custom DHCP options set with a Net to apply the options it contains to virtual machines (VMs) created in this Net.

This action replaces the DHCP options set with another one, as you can associate a Net with one DHCP options set only at a time.

When you modify the DHCP options set associated with a Net, the options it contains are automatically applied to both existing VMs and VMs that you create afterward. Existing VMs apply these options within a few hours after you modify the DHCP options set, depending on their DHCP lease renewal frequency. You do not need to restart the VMs. You can however force the renewal of your DHCP lease using the dhclient command for Linux VMs, or the ipconfig/renew command for Windows VMs.

Modifying the DHCP Options Set Associated with a Net Using Cockpit v2

  1. In the Nets dashboard, check the box of the Net you want to associate with the DHCP options set.
    The Net is selected.

  2. Click IconEdit Update.
    The UPDATE DHCP OPTIONS SET dialog box appears.

  3. In the DHCP options list, select the DHCP options set you want to associate with your Net.

  4. Click Update.
    The DHCP options set is associated with the Net and replaces the previous set.

Modifying the DHCP Options Set Associated with a Net Using OSC CLI

The UpdateNet command associates a DHCP options set with a specified Net.

Request sample
$ osc-cli api UpdateNet --profile "default" \
    --NetId "vpc-12345678" \
    --DhcpOptionsSetId "dopt-12345678"

This command contains the following attributes that you need to specify:

  • DhcpOptionsSetId: The ID of the DHCP options set (or default if you want to associate the default one).

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • NetId: The ID of the Net.

The UpdateNet command returns the following elements:

  • Net: Information about the Net.

    • DhcpOptionsSetId: The ID of the DHCP options set (or default if you want to associate the default one).

    • IpRange: The IP range for the Net, in CIDR notation (for example, 10.0.0.0/16).

    • NetId: The ID of the Net.

    • State: The state of the Net (pending | available | deleting).

    • Tags: One or more tags associated with the Net.

      • Key: The key of the tag, with a minimum of 1 character.

      • Value: The value of the tag, between 0 and 255 characters.

    • Tenancy: The VM tenancy in a Net.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Net": {
    "Tags": [],
    "DhcpOptionsSetId": "dopt-12345678",
    "IpRange": "10.0.0.0/16",
    "Tenancy": "default",
    "NetId": "vpc-12345678",
    "State": "available"
  }
}

Modifying the DHCP Options Set Associated with a Net Using oapi-cli

The UpdateNet command associates a DHCP options set with a specified Net.

Request sample
$ oapi-cli --profile "default" UpdateNet \
    --NetId "vpc-12345678" \
    --DhcpOptionsSetId "dopt-12345678"

This command contains the following attributes that you need to specify:

  • DhcpOptionsSetId: The ID of the DHCP options set (or default if you want to associate the default one).

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • NetId: The ID of the Net.

The UpdateNet command returns the following elements:

  • Net: Information about the Net.

    • DhcpOptionsSetId: The ID of the DHCP options set (or default if you want to associate the default one).

    • IpRange: The IP range for the Net, in CIDR notation (for example, 10.0.0.0/16).

    • NetId: The ID of the Net.

    • State: The state of the Net (pending | available | deleting).

    • Tags: One or more tags associated with the Net.

      • Key: The key of the tag, with a minimum of 1 character.

      • Value: The value of the tag, between 0 and 255 characters.

    • Tenancy: The VM tenancy in a Net.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Net": {
    "Tags": [],
    "DhcpOptionsSetId": "dopt-12345678",
    "IpRange": "10.0.0.0/16",
    "Tenancy": "default",
    "NetId": "vpc-12345678",
    "State": "available"
  }
}

Modifying the DHCP Options Set Associated with a VPC Using AWS CLI

Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI.

To modify the DHCP options set associated with a VPC, use the associate-dhcp-options command following this syntax:

Request sample
$ aws ec2 associate-dhcp-options \
    --profile YOUR_PROFILE \
    --dhcp-options-id dopt-1234abcd \
    --vpc-id vpc-12345678 \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • dhcp-options-id: The ID of the DHCP options set you want to associate with the VPC, or default if you want to associate the default one.

    A VPC cannot have no DHCP options set associated with it.

  • vpc-id: The ID of the VPC you want to associate the DHCP options set with.

  • endpoint: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.

The DHCP options set is associated with the specified VPC.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.