日本語ドメインをDNSに設定する方法
日本語ドメインそのままDNSに設定するとエラーが発生する。
punycodeに変換して使用する必要がある。
idnコマンドを利用する
idnコマンドを使用してpunycodeに変換する。
下記でidnコマンドをインストール
yum install libidn
コマンド
# idn 日本語
libidn 1.18
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson.
GNU Libidn comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Libidn under the terms of
the GNU Lesser General Public License. For more information
about these matters, see the file named COPYING.LIB.
xn--wgv71a119e
上記のように日本語は「xn--wgv71a119e」と変換される
zoneファイルへの記述
bindのゾーンファイルへは変換後の文字列で記載します。
zoneファイル
zone "test.xyz" {type master; allow-query { any; }; file "test.xyz.db";};
zone "xn--wgv71a119e.xyz" {type master; allow-query { any; }; file "common.zone.db";};
確認方法
digコマンドはそのまま日本語が使用できます。
変換後の文字列でもOKです。
下記どちらでも同じ結果になります。
# dig 日本語.xyz @localhost
# dig xn--wgv71a119e.xyz @localhost
以上