Obtenir des informations sur vos options DHCP

Vous pouvez obtenir des informations sur un ou plusieurs de vos groupes d’options DHCP, comme leur ID et les options qu’ils contiennent.

Pour consulter quel groupe d’options DHCP est associé à un Net, voir Obtenir des informations sur vos Nets.

Obtenir des informations sur vos options DHCP avec Cockpit v2

Voir le dashboard DHCP Options.

Obtenir des informations sur vos options DHCP avec OSC CLI

À ce jour, cette section est disponible en anglais uniquement.

The ReadDhcpOptions command gets information about the content of one or more DHCP options sets.

Request sample
$ osc-cli api ReadDhcpOptions --profile "default" \
    --Filters '{
        "DhcpOptionsSetIds": ["dopt-12345678"],
      }'
Request sample
$ osc-cli api ReadDhcpOptions --profile "default" \
    --Filters '{
        "DomainNameServers": ["192.0.2.0", "198.51.100.0"],
        "DomainNames": ["example.com"],
      }'

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

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

  • Filters: (optional) One or more filters.

    • Default: (optional) If true, lists all default DHCP options set. If false, lists all non-default DHCP options set.

    • DhcpOptionsSetIds: (optional) The IDs of the DHCP options sets.

    • DomainNameServers: (optional) The IPs of the domain name servers used for the DHCP options sets.

    • DomainNames: (optional) The domain names used for the DHCP options sets.

    • LogServers: (optional) The IPs of the log servers used for the DHCP options sets.

    • NtpServers: (optional) The IPs of the Network Time Protocol (NTP) servers used for the DHCP options sets.

    • TagKeys: (optional) The keys of the tags associated with the DHCP options sets.

    • TagValues: (optional) The values of the tags associated with the DHCP options sets.

    • Tags: (optional) The key/value combination of the tags associated with the DHCP options sets, in the following format: "Filters":{"Tags":["TAGKEY=TAGVALUE"]}.

  • NextPageToken: (optional) The token to request the next page of results. Each token refers to a specific page.

  • ResultsPerPage: (optional) The maximum number of logs returned in a single response (between 1`and `1000, both included). By default, 100.

The ReadDhcpOptions command returns the following elements:

  • DhcpOptionsSets: Information about one or more DHCP options sets.

    • Default: If true, the DHCP options set is a default one. If false, it is not.

    • DhcpOptionsSetId: The ID of the DHCP options set.

    • DomainName: The domain name.

    • DomainNameServers: One or more IPs for the domain name servers.

    • LogServers: One or more IPs for the log servers.

    • NtpServers: One or more IPs for the NTP servers.

    • Tags: One or more tags associated with the DHCP options set.

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

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

  • NextPageToken: The token to request the next page of results. Each token refers to a specific page.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "DhcpOptionsSets": [
    {
      "Tags": [],
      "NtpServers": [
        "203.0.113.0",
        "203.0.113.1"
      ],
      "Default": false,
      "DhcpOptionsSetId": "dopt-12345678",
      "DomainName": "example.com",
      "DomainNameServers": [
        "192.0.2.0",
        "198.51.100.0"
      ]
    }
  ]
}

Obtenir des informations sur vos options DHCP avec AWS CLI

Pour obtenir des informations sur un ou plusieurs groupes d’options DHCP, utilisez la commande describe-dhcp-options en suivant cette syntaxe :

Exemple de requête
$ aws ec2 describe-dhcp-options \
    --profile YOUR_PROFILE \
    --dhcp-options-ids NOT_SPECIFIED \
    --filters [ \
               { \
                Name:Key, \
                Values:domain-name \
               } \
             ] \
    --endpoint https://fcu.eu-west-2.outscale.com

Cette commande contient les attributs suivants que vous devez spécifier :

  • (optionnel) profile : Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI.

  • dhcp-options-ids : Un ou plusieurs ID de groupes d’options DHCP.

  • (optionnel) filters : Un ou plusieurs filtres, au format "Name=X,Values=Y".

    Vous pouvez spécifier plusieurs valeurs pour un même filtre en utilisant le format "Name=X,Values=Y, Z".

    Les filtres suivants sont disponibles :

    • dhcp-options-id : L’ID d’un groupe d’options DHCP

    • key : Le nom de l’une des options DHCP (domain-name-servers, ntp-servers ou log-servers).

    • value : La valeur de l’une des options DHCP.

    • tag-key : La clé d’un tag associé à la ressource.

    • tag-value : La valeur d’un tag associé à la ressource.

    • tag:XXXX : La valeur d’un tag associé à la ressource, où XXXX est la clé du tag.

      Pour filtrer un tag dont la clé est XXXX et la valeur est YYYY, vous pouvez donc utiliser un des deux formats suivants :

      • --filters Name=tag-key,Values=XXXX Name=tag-value,Values=YYYY

      • --filters Name=tag:XXXX,Values=YYYY

  • endpoint : Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête.

La commande describe-dhcp-options renvoie les éléments suivants :

  • DhcpOptions : Informations à propos d’un ou plusieurs groupes d’options DHCP. Cet élément contient les informations suivantes :

    • DhcpConfigurations : Informations à propos des options DHCP que le groupe contient. Cet élément contient les informations suivantes :

      • Value : Une ou plusieurs valeurs pour l’option DHCP.

      • Key : Le nom de l’option DHCP.

    • DhcpOptionsId : L’ID du groupe d’options DHCP.

    • Tags : Un ou plusieurs tags attachés au groupe d’options DHCP.

      • TagKey : La clé d’un tag associé à la ressource.

      • TagValue : La valeur d’un tag associé à la ressource.

Exemple de résultat
 {
    "DhcpOptions": {
        "DhcpConfigurations": [
            {
                "Values": [
                    "10.2.5.2",
                    "10.2.5.1"
                ],
                "Key": "domain-name-servers"
            },
            {
                "Values": "mycompany.com",
                "Key": "domain-name"
            },
            {
                "Values": "10.2.5.2",
                "Key": "ntp-servers"
            },
            {
                "Values": "10.2.5.3"
                "Key": "log-servers"
            }
        ],
        "DhcpOptionsId": "dopt-1234abcd",
        "Tags": []
    }
}

Pages connexes

Méthodes API correspondantes

AWS™ et Amazon Web Services™ sont des marques de commerce d’Amazon Technologies, Inc. ou de ses affiliées aux États-Unis et/ou dans les autres pays.