0
0

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 1 year has passed since last update.

BINDに追加したレコードが引けない話

Posted at

はじめに

久しぶりにBINDでゾーンファイルを編集したら躓いたのでメモ。

作業前の状況とやりたかったこと

example.jpを例示ドメインとし、分かりやすくするためTTLとSOAの記述は省略しています。

example.jp
      IN      NS      ns1.example.com.
      IN      A       192.168.254.1

今回追記しようとしていたレコードは次の通りです。

名前 クラス 種別
subdomain IN CNAME subdomain.example.com
sub IN TXT "TEXT RECORD"

設定後の状況

上記のことを踏まえて、下記のようにゾーンファイルを設定しました。

example.jp
             IN      NS      ns1.example.com.
             IN      A       192.168.254.1
subdomain    IN      CNAME   subdomain.example.com
      sub    IN      TXT     "TEXT RECORD"

ゾーンファイルチェックでエラーが出ないことを確認して、BINDをリロードします。
その後、確認のためnslookupで確認しました

*** ns1.example.com が subdomain.example.jp を見つけられません: Non-existent domain
*** ns1.example.com が sub.example.jp を見つけられません: Non-existent domain

さて、どこが間違っていたのでしょう?

CNAMEレコードの誤り

設定したかった値は subdomain.example.com ですが、この場合にはBINDのゾーンファイルで狭義のFQDN、つまり subdomain.example.com. と末尾にピリオド付きで指定する必要があります。
初回設定時の内容では subdomain.example.com.example.jp. を指定したのと同じ扱いになります。そんなものはない。

TXTレコードの誤り

見かけ上の位置を揃えるために、レコードが半角スペースから始まっています。
つまりBINDでは実質的に下記のように解釈されるものと思われます。

名前 クラス 種別? 値? ???
(なし) sub IN TXT "TEXT RECORD"

クラスがインターネット(IN)以外のレコードになってしまっています。
見出しにTXTレコードの誤りと書いたな。あれは嘘だ。(などと)

正しい追記後の例示

example.jp
             IN      NS      ns1.example.com.
             IN      A       192.168.254.1
subdomain    IN      CNAME   subdomain.example.com.
sub          IN      TXT     "TEXT RECORD"

さいごに

BINDこわい。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?