0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Cloudflare に対する DNS コマンドメモ

Last updated at Posted at 2021-07-06

Normal DNS

IPv4 query

IPv4 record

dig -4 @1.1.1.1 www.cloudflare.com A +short

IPv6 record

dig -4 @1.1.1.1 www.cloudflare.com AAAA +short

IPv6 query

IPv4 record

dig -6 @2606:4700:4700::1111 www.cloudflare.com A +short

IPv6 record

dig -6 @2606:4700:4700::1111 www.cloudflare.com AAAA +short

DNS over HTTPS (DoH)

IPv4 query

IPv4 record

curl -4 -s -H 'accept: application/dns-json' \
'https://cloudflare-dns.com/dns-query?name=www.cloudflare.com&type=A' | jq

個人的には結果が見やすいのが好みです。

{
  "Status": 0,
  "TC": false,
  "RD": true,
  "RA": true,
  "AD": true,
  "CD": false,
  "Question": [
    {
      "name": "www.cloudflare.com",
      "type": 1
    }
  ],
  "Answer": [
    {
      "name": "www.cloudflare.com",
      "type": 1,
      "TTL": 53,
      "data": "104.16.123.96"
    },
    {
      "name": "www.cloudflare.com",
      "type": 1,
      "TTL": 53,
      "data": "104.16.124.96"
    }
  ]
}

IPv6 record

curl -4 -s -H 'accept: application/dns-json' \
'https://cloudflare-dns.com/dns-query?name=www.cloudflare.com&type=AAAA' | jq

IPv6 query

IPv4 record

curl -6 -s -H 'accept: application/dns-json' \
'https://cloudflare-dns.com/dns-query?name=www.cloudflare.com&type=A' | jq

IPv6 record

curl -6 -s -H 'accept: application/dns-json' \
'https://cloudflare-dns.com/dns-query?name=www.cloudflare.com&type=AAAA' | jq

DNS over TLS (DoT)

brew install knot

IPv4 query

IPv4 record

kdig -4 @1.1.1.1 +tls-ca +tls-host=cloudflare-dns.com  www.cloudflare.com A +short

↓結果

;; TLS session (TLS1.3)-(ECDHE-X25519)-(ECDSA-SECP256R1-SHA256)-(AES-256-GCM)
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 49543
;; Flags: qr rd ra; QUERY: 1; ANSWER: 2; AUTHORITY: 0; ADDITIONAL: 1

;; EDNS PSEUDOSECTION:
;; Version: 0; flags: ; UDP size: 1232 B; ext-rcode: NOERROR
;; PADDING: 385 B

;; QUESTION SECTION:
;; www.cloudflare.com. 		IN	A

;; ANSWER SECTION:
www.cloudflare.com. 	83	IN	A	104.16.124.96
www.cloudflare.com. 	83	IN	A	104.16.123.96

;; Received 468 B
;; Time 2021-07-07 09:56:54 JST
;; From 1.1.1.1@853(TCP) in 12.7 ms

IPv6 record

kdig -4 @1.1.1.1 +tls-ca +tls-host=cloudflare-dns.com  www.cloudflare.com AAAA +short

IPv6 query

IPv4 record

kdig -6 @2606:4700:4700::1111 +tls-ca +tls-host=cloudflare-dns.com  www.cloudflare.com A +short

IPv6 record

kdig -6 @2606:4700:4700::1111 +tls-ca +tls-host=cloudflare-dns.com  www.cloudflare.com AAAA +short

参考:Whoami

IPv4 query

dig -4 +short @1.1.1.1 whoami.cloudflare ch txt | sed "s/\"//g"

IPv6 query

dig -6 +short @2606:4700:4700::1111 ch txt whoami.cloudflare | sed "s/\"//g"

参考:Whoami over TLS

IPv4 query

kdig -4 @1.1.1.1 +tls-ca +tls-host=cloudflare-dns.com whoami.cloudflare ch txt +short | sed "s/\"//g"

IPv6 query

kdig -6 @2606:4700:4700::1111 +tls-ca +tls-host=cloudflare-dns.com whoami.cloudflare ch txt +short | sed "s/\"//g"

参考:WhatsMyIp

IPv4 query

curl -4 -s https://cloudflare.com/cdn-cgi/trace | grep ip | awk -F'=' '{print $2}'

IPv6 query

curl -6 -s https://cloudflare.com/cdn-cgi/trace | grep ip | awk -F'=' '{print $2}'

参考:Which node

dig -4 +short @1.1.1.1 id.server ch txt | sed "s/\"//g"
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?