コンテンツにスキップ

DNSレコードタイプ

このページでは、Cloudflareで管理できるさまざまなDNSレコードのタイプについての情報を提供します。DNSレコードの追加、編集、削除方法については、DNSレコードの管理を参照してください。


IPアドレス解決

Cloudflareの各ドメインには、少なくとも1つのIPアドレス解決レコードが必要です。これらのレコードは、Cloudflareを通じてプロキシできる唯一のレコードです。

AおよびAAAA

A and AAAA records map a domain name to one or multiple IPv4 or IPv6 address(es).

これらのレコードには、以下のフィールドが含まれます:

  • Name: サブドメインまたはゾーンのアペックス(@)で、次の条件を満たす必要があります:

    • 63文字以下であること
    • 文字で始まり、文字または数字で終わること
    • 文字、数字、またはハイフンのみを含むこと(アンダースコアは許可されていますが推奨されません)
  • IPv4/IPv6アドレス: オリジンサーバーのアドレス(Cloudflare IPではない)

  • TTL: 生存時間で、DNSリゾルバが応答をキャッシュする期間を制御します。

    • Proxy StatusProxiedの場合、この値はデフォルトでAuto(300秒)になります。
    • Proxy StatusDNS Onlyの場合、値をカスタマイズできます。
  • Proxy status: 詳細については、プロキシDNSレコードを参照してください。

API呼び出しの例

AまたはAAAAレコードをAPIを使用して作成する場合:

  • レコードのcontentはIPアドレス(Aの場合はIPv4、AAAAの場合はIPv6)です。
  • proxiedフィールドは、レコードのプロキシステータスに影響します。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

Request
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type": "A",
"name": "www.example.com",
"content": "192.0.2.1",
"ttl": 3600,
"proxied": false
}'
Response
{
"result": {
"id": "<ID>",
"zone_id": "<ZONE_ID>",
"zone_name": "example.com",
"name": "www.example.com",
"type": "A",
"content": "192.0.2.1",
"proxiable": true,
"proxied": false,
"ttl": 1,
"locked": false,
"meta": {
"auto_added": false,
"managed_by_apps": false,
"managed_by_argo_tunnel": false,
"source": "primary"
},
"comment": null,
"tags": [],
"created_on": "2023-01-17T20:37:05.368097Z",
"modified_on": "2023-01-17T20:37:05.368097Z"
},
"success": true,
"errors": [],
"messages": []
}

CNAME

CNAME records map a domain name to another (canonical) domain name. They can be used to resolve other record types present on the target domain name.

これらのレコードには、以下のフィールドが含まれます:

  • Name: サブドメインまたはゾーンのアペックス(@)で、次の条件を満たす必要があります:
    • 63文字以下であること
    • 文字で始まり、文字または数字で終わること
    • 文字、数字、またはハイフンのみを含むこと(アンダースコアは許可されていますが推奨されません)
  • Target: トラフィックが向けられるホスト名(example.com)。
  • TTL: 生存時間で、DNSリゾルバが応答をキャッシュする期間を制御します。
    • Proxy StatusProxiedの場合、この値はデフォルトでAuto(300秒)になります。
    • Proxy StatusDNS Onlyの場合、値をカスタマイズできます。
  • Proxy status: 詳細については、プロキシDNSレコードを参照してください。

CNAMEレコードを使用して他のCNAMEレコードを指すことができます(www.example2.com —> www.example1.com —> www.example.com)、ただし、最終的なレコードは有効なIPアドレスを持つホスト名を指す必要があります(したがって、有効なAまたはAAAAレコードが必要です)もしこのホスト名がトラフィックをプロキシすることを意図している場合。

Cloudflareは、より良いパフォーマンスを提供するためにCNAMEフラッティングと呼ばれるプロセスを使用しています。このプロセスは、いくつかの機能をサポートし、CNAMEレコードに依存するさまざまなセットアップと相互作用できます。詳細については、CNAMEフラッティングセクションを参照してください。

API呼び出しの例

CNAMEレコードをAPIを使用して作成する場合:

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

Request
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type": "CNAME",
"name": "www.example.com",
"content": "www.another-example.com",
"ttl": 3600,
"proxied": false
}'
Response
{
"result": {
"id": "<ID>",
"zone_id": "<ZONE_ID>",
"zone_name": "example.com",
"name": "www.example.com",
"type": "A",
"content": "www.another-example.com",
"proxiable": true,
"proxied": false,
"ttl": 1,
"locked": false,
"meta": {
"auto_added": false,
"managed_by_apps": false,
"managed_by_argo_tunnel": false,
"source": "primary"
},
"comment": null,
"tags": [],
"created_on": "2023-01-17T20:37:05.368097Z",
"modified_on": "2023-01-17T20:37:05.368097Z"
},
"success": true,
"errors": [],
"messages": []
}

メール認証

これらのレコードは、ドメインがメールメッセージを送信するかどうかに関係なく推奨されます。安全なメールレコードを作成することで、ドメインをメールスプーフィングから保護できます。

ドメインがメールメッセージを送信するために使用されていない場合は、推奨される制限付きレコードの作成について詳しく学んでください。

MX

メールサーバーにメールを配信するには、メール交換(MX)レコードが必要です。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

DKIM

ドメインキー識別メール(DKIM)レコードは、メールを暗号的に署名することでメールの真正性を保証します:

SPF

送信者ポリシーフレームワーク(SPF)レコードは、ドメインの代わりにメールを送信できる権限のあるIPアドレスとドメインのリストを示します。

DMARC

ドメインベースのメッセージ認証報告および適合(DMARC)レコードは、メールトラフィックに関する集計レポートを生成し、メール受信者が不適合のメールをどのように扱うべきかについて明確な指示を提供します。


専門的なレコード

TXT

テキスト(TXT)レコードを使用すると、DNSシステムにテキストを入力できます。

Cloudflareでは、これらは主に、あなたのドメインのSSL/TLS証明書を発行する前にドメイン所有権を示すために使用されます。または、Cloudflare for SaaSドメインのために使用されます。

これらを使用してメール認証レコードを作成することもできますが、代わりにメールセキュリティウィザードを使用することをお勧めします。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

CAA

証明書発行機関認可(CAA)レコードは、どの証明書発行機関(CA)がドメインの証明書を発行できるかを指定します。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

SRV

サービスレコード(SRV)は、音声通話(VOIP)、インスタントメッセージングなどの特定のサービスのためのホストとポートを指定します。

API呼び出しの例

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

Request
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type": "SRV",
"name": "_xmpp._tcp.example.com",
"data": {
"priority": 10,
"weight": 5,
"port": 5223,
"target": "server.example.com"
}
}'
Response
{
"result": {
"id": "<ID>",
"zone_id": "<ZONE_ID>",
"zone_name": "example.com",
"name": "_xmpp._tcp.example.com",
"type": "SRV",
"content": "5 5223 server.example.com",
"priority": 10,
"proxiable": false,
"proxied": false,
"ttl": 1,
"locked": false,
"data": {
"port": 5223,
"priority": 10,
"target": "server.example.com",
"weight": 5
},
"meta": {
"auto_added": false,
"managed_by_apps": false,
"managed_by_argo_tunnel": false,
"source": "primary"
},
"comment": null,
"tags": [],
"created_on": "2022-11-08T15:57:39.585977Z",
"modified_on": "2022-11-08T15:57:39.585977Z"
},
"success": true,
"errors": [],
"messages": []
}

SVCBおよびHTTPS

サービスバインディング(SVCB)およびHTTPSサービス(HTTPS)レコードを使用すると、クライアントにサーバーへの接続方法に関する情報を事前に提供できます。初期の平文HTTP接続は必要ありません。

ドメインにHTTP/2またはHTTP/3が有効な場合、Cloudflareは自動的にHTTPSレコードを生成し、クライアントにサーバーへの接続方法を通知します。

詳細とコンテキストについては、発表ブログ記事およびRFC 9460を参照してください。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

PTR

ポインタ(PTR)レコードは、特定のIPアドレスに対して許可されたホストを指定します。

Cloudflare内では、PTRレコードは逆引きDNSルックアップに使用され、逆ゾーンに追加することが推奨されます。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

SOA

権威の開始(SOA)レコードは、管理者のメールアドレス、ドメインが最後に更新された日時など、ドメインに関する情報を保存します。

Cloudflareを権威DNSとして使用している場合、SOAレコードを作成する必要はありません。Cloudflareは、Cloudflareの権威ネームサーバーを使用し始めると、自動的にこのレコードを作成します。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

NS

ネームサーバー(NS)レコードは、権威DNSに使用するサーバーを示します。

カスタムまたはバニティネームサーバーを作成する場合、サブドメインセットアップを使用する場合、またはCloudflareの外部にサブドメインを委任する場合にのみ、NSレコードを追加する必要があります。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).

DSおよびDNSKEY

DSおよびDNSKEYレコードは、DNSSECを実装するのに役立ちます。DNSSECは、ドメインスプーフィングを防ぐためにDNSレコードに暗号的に署名します。

ほとんどのCloudflareドメインは、これらのレコードを追加する必要はなく、代わりにDNSSECセットアップガイドに従うべきです。

For field definitions, refer to the API documentation (visible once you select the record type under the request body specification).