コンテンツにスキップ

プロキシDNSレコード

DDoS保護の最初のステップ - そしてしばしば最も簡単なステップ - は、DNSレコードがCloudflareを通じてプロキシされていることを確認することです。

仕組み

Without Cloudflare

Without Cloudflare, DNS lookups for your application’s URL return the IP address of your origin server.

URLReturned IP address
example.com192.0.2.1

When using Cloudflare with unproxied DNS records, DNS lookups for unproxied domains or subdomains also return your origin’s IP address.

Another way of thinking about this concept is that visitors directly connect with your origin server.

        flowchart LR
        accTitle: Connections without Cloudflare
        A[Visitor] <-- Connection --> B[Origin server]

With Cloudflare

With Cloudflare — meaning your domain or subdomain is using proxied DNS records — DNS lookups for your application’s URL will resolve to Cloudflare anycast IPs instead of their original DNS target.

URLReturned IP address
example.com104.16.77.250

This means that all requests intended for proxied hostnames will go to Cloudflare first and then be forwarded to your origin server.

        flowchart LR
        accTitle: Connections with Cloudflare
        A[Visitor] <-- Connection --> B[Cloudflare global network] <-- Connection --> C[Origin server]

Cloudflare assigns specific anycast IPs to your domain dynamically and these IPs may change at any time. This is an expected part of the operation of our anycast network and does not affect the proxy behavior described above.

効果

DDoS保護

トラフィックがCloudflareを通じてプロキシされると、Cloudflareは自動的にDDoS攻撃があなたのアプリケーション(およびオリジンサーバー)に到達するのを防ぐことができます。

キャッシング

プロキシされたトラフィックは、Cloudflareのキャッシュのデフォルト最適化の恩恵も受けます。Cloudflareは特定のタイプのリソースを自動的にキャッシュし、これによりアプリケーションのパフォーマンスが向上し、全体のリクエスト数が減少します。

オリジンIPアドレスの隠蔽

CloudflareでDNSレコードをプロキシすることにより、オリジンサーバーのIPアドレスも隠されます(アプリケーションへのリクエストはCloudflareのAnycast IPアドレスに解決されるため)。

この不明瞭さにより、誰かが直接オリジンに接続することが難しくなり、結果としてDDoS攻撃のターゲットにすることも難しくなります。

方法

レコードをプロキシする前に、リクエストがブロックされないように、オリジンでCloudflareのIPアドレスを許可する必要があります。

次に、CloudflareのDNSレコードを更新し、そのプロキシステータスプロキシ済みであることを確認します。

プロキシステータスはCloudflareが特定のDNSレコード向けのトラフィックをどのように扱うかに影響します