DNSサーバの設定

DNS server setup

DNSサーバにて多言語ドメイン名を扱うための設定方法について 解説します。とはいっても従来の ASCII ドメイン名の場合の設定方法と 大きく変わるわけではありません。注意すべき点は次の2点だけです。

This document describes how to configure a DNS server to enable handling of multilingual domain names. This configuration procedure does not differ greatly from that used for configuring ASCII domain names. However, two points have to be borne in mind.

DNSサーバの設定の手順は、およそ以下の通りです。

Configure a DNS server according to the following procedure.

  1. エンコーディング・正規化方式を決める。
    Determine the encoding and normalization scheme.
  2. DNS サーバを用意する。
    Set a DNS server.
  3. named.conf、ゾーンマスタファイルを作成する。
    Create named.conf, a zone master file.

最後のファイル作成に関しては、エンコーディングとして UTF-5 を 使用したときに特有の問題があり、これを

When UTF-5 is used for encoding during file generation, the last item, specific problems occur. These problems are discussed in the following section.

としてまとめてあります。

設定で使用するエンコーディング変換ツール mdnconv の外部仕様 および内部処理の詳細に関しては、 mdnconv の仕様書をご覧ください。

For information on external specifications and internal processing of mdnconv, the encoding conversion tool, used in the setup, refer to the mdnconv specifications.

また、クライアントからこれらの DNS サーバにアクセスするためには、 多言語ドメイン名用パッチを当てた bind9runmdn コマンドmDN Wrapper などを使用してクライアント側で エンコーディング変換や正規化を行うか、あるいは エンコーディング変換を行うプロキシサーバである dnsproxy を通す必要があります。 dnsproxy の設定については DNS Proxy Server のコンフィギュレーションで説明します。

To enable the client to access these DNS servers, encoding, conversion and normalization using bind9 with a multilingual domain name patch installed、the runmdn command、the mDN Wrapper or similar tool must be used on the client side or access has to be made via dnsproxy, a proxy server that performs encoding and conversion. dnsproxy configuration is described in DNS Proxy Server configuration.


エンコーディング・正規化方式の決定

Determining Encoding and Normalization Scheme

まず DNS の設定に先だって、DNS サーバで使用するドメイン名の エンコーディングおよび正規化方式を決める必要があります。

The encoding and normalization scheme to be used for a DNS server must be determined prior to DNS setup.

評価しようとする DNS の多言語化方式が決まっていれば、 その方式に合わせることになります。 現在提案されている方式の中から、使用するエンコーディング・正規化を いくつか紹介します。これ以外の方式も多数提案されています。詳しくは 参考文献をご覧ください。

Encoding scheme should be selected to suit a DNS multilingual system to be assessed. The following are some of the currently proposed encoding and normalization schemes. Various other systems are also being proposed. For details, see reference document.

エンコーディングとして UTF-5 を採用した場合には、 ZLD (zero level domain) を付けることで従来のドメイン名と区別する必要が あります。したがって ZLD を何にするかも決定する必要があります。

When UTF-5 encoding is employed, it is essential to distinguish it from traditional domain names by adding ZLD (zero level domain). Consequently, it is necessary to determine which type of ZLD is to be used.★ZLD を何にするか★

その他 mDNkit がサポートしているエンコーディング・正規化方式については MDN ライブラリの仕様を参照してください。

Refer to the MDN library specifications for information on other encoding and normalization schemes supported by the mDNkit.

もちろん、1台の DNS サーバに複数のエンコーディングを持たせることも可能 です。この場合はゾーン毎に異なるエンコーディングを割り当てることになる でしょう。ただし mDNkit を用いて多言語ドメイン名の扱いを可能にした クライアントや dnsproxy は DNS サーバ側のエンコーディングが単一である ことを仮定しているので、例えば dnsproxy の場合にはエンコーディング毎に 複数の dnsproxy を起動するなどのテクニックが必要です。

Of course, multiple types of encoding schemes can be employed for one DNS server.In such a case, a different type of encoding would be assigned to each zone. However, a client or dnsproxy enabled to support multilingual domain names through mDNkit assumes that a DNS server employs a single encoding scheme. Such techniques that start up multiple dnsproxies to handle all encodings would have to be used for dnsproxy.


DNS サーバの用意

Setting up a DNS server

エンコーディングとして ASCII 互換エンコーディング (ACE: ASCII Compatible Encoding) である RACE、UTF-5 を用いる場合には、エンコード結果は従来の ホスト名として正当な文字列になるので、現在使用中の DNS サーバをそのまま 使うことができます。しかし ASCII 互換エンコーディング以外のエンコーディング、 特に UTF-8 を用いる場合には、多言語ドメイン処理を付加するパッチを当てた bind9 の DNS サーバ (named) を使用するか、 8ビットスルーパッチを当てた bind8 の DNS サーバを用意する必要があります。

When ASCII compatible encoding (ACE: ASCII Compatible Encoding) such as RACE or UTF-5 is used, the encoding results legal characters in traditional host names and allow use of current DNS servers. However, the other encoding schemes, especially UTF-8, requires the use of a bind9 DNS server (named) with a multilingual domain patch installed, or a bind8 DNS server with an 8-bit through patch installed.

それぞれのパッチの当て方およびインストールの方法については bind9 用パッチの適用とインストール および bind8 用パッチの適用とインストール を ご覧ください。

For information on procedures for adding or installing these patches, refer to Adding and installing bind9 patch and Adding and installing bind8 patch.


named.conf、ゾーンマスタファイルの作成

Creating named.conf and a zone master file

named.conf やゾーンマスタファイル書き方自体は、 多言語ドメイン名と従来のドメイン名で変わるところはありません。 単にドメイン名に漢字などを含めることができるかどうかだけの違いです。

The writing of named.conf and zone master files for multilingual domain names does not differ from those of traditional domain names. The only difference is that the domain names contain kanji or other non-ASCII characters.

DNS サーバ自体にエンコーディング変換機能は備わっていないので、 DNS の読み込む named.conf ファイルやゾーンマスタファイルの エンコーディングはエンコーディング・正規化方式の決定で 決定したエンコーディングに合わせる必要があります。 mdnconv はこのような目的のために設計されたコード変換ツールです。

Since the DNS server does not contain the encoding coversion function, the encoding of the named.conf file and zone master file read by DNS must be adjusted to encoding determined by the encoding and normalization scheme. mdnconv is the code conversion tool designed to solve this problem.

RACE や UTF-5 なら、ASCII 文字が編集できるエディタがあれば直接入力 することも可能ですが、例えば「こんにちは.世界.」と入力する代わりに bq--gbjzg23bn4.bq--3bhbm5km. などといった暗号のような文字列を (しかも正確に) 入力しなければならず、 変換ツールを使用するほうがはるかにに簡単です。

Although an ASCII character editor allows direct entries with RACE and UTF-5, you would be forced to accurately enter code strings such as bq--gbjzg23bn4.bq--3bhbm5km. for 「こんにちは.世界.」. Thus the conversion tool radically simplifies the character entry task.

UTF-8 ならばエディタによっては直接編集可能なものがあるので、それを 使うこともできます。しかしそのエディタも正規化までは多分してくれない でしょうから、やはりツールでエンコーディング変換することをお勧めします。

Editors that allow direct editing with UTF-8 can also be used. However, since such editors will probably not support normalization; encoding conversion is again the recommended procedure.

例えば次のようなコマンドを実行すると EUC-JP で書かれたゾーンマスタファイル db.somezone.euc を RACE エンコーディングの db.somezone.race に変換し、同時に Unicode Normalization Form C による正規化を適用する ことができます。

For example when the following command is executed, the db.somezone.euc zone master file is converted to db.somezone.race RACE encoding and is simultaneously normalized according to Unicode Normalization Form C.

% mdnconv -noconf -in EUC-JP -out RACE -normalize unicode-form-c \
	db.foo.euc > db.foo.race

-in オプションで入力テキストのエンコーディングを、 -out で出力テキストのエンコーディングを、 そして -normalize で正規化方式を指定します。 オプションの一覧とどのような値が指定できるかについては、 mdnconv の仕様書をご覧ください。

-in option specifies encoding of input text, -out specifies output text encoding and -normalize specifies the normalization scheme.Refer to mdnconv specifications for a list of options and other values.

ではこの逆に RACE エンコーディングから EUC-JP への変換ができるかというと、 RACE エンコーディングの場合には可能です。ただしこれは mdnconv が RACE エンコーディング専用の特別な処理を備えているためで、 一般的には ASCII 互換エンコーディングからローカルエンコーディングへの変換は できないということを覚えておいてください。 これは、入力された文字列の中で ASCII 互換エンコーディングを用いて 表記されている個所とそうでない通常の ASCII 表記の場所を区別できないからです。 これについては mdnconv の仕様書の 変換処理の詳細を参照してください。

RACE encoding also allows you to do the opposite; to convert from RACE encoding to EUC-JP encoding. But note that this is only because mdnconv is provided with RACE encoding specific processing; normally, it is not possible to convert from ASCII compatible encoding to local encoding. The reason is that it is not possible to distinguish between characters denoted in ASCII compatible encoding and those that use normal ASCII encoding in entered character strings. Refer to the conversion information, the mdnconv specifications, for details.

以上のことから、ゾーンマスタファイル等 DNS サーバが読み込むファイル の作成と管理には次のような方法をとるのがよいと考えられます。 まずローカルエンコーディングを用いて記述した版を用意して、これに対して 編集やバージョン管理を行います。 そして mdnconv を用いてエンコーディング変換と正規化を行い、 DNS サーバの使用するエンコーディング版のファイルを生成して、これを DNS サーバが読み込むためのファイルとして使用します。

Consequently, the following procedure should be adhered to in creating and maintaining zone master files and other files that are to be read by a DNS server.First, create a file version in local encoding that is edited under version control. Then use mdnconv to convert encoding and normalize the file to generate a file with the encoding employed by a DNS server and use it as the file the DNS server will read.

とはいってもローカルエンコーディング版のファイルを改訂するたびに mdnconv を実行してサーバエンコーディング版のファイルを作るのは面倒です。 この場合例えば make コマンドを使用すれば変換を自動化することができます。

However, executing mdnconv each time a locally encoded file has to be converted to a server encoded file is time-consuming. In this situation, use the make command to automate conversion.

例えばローカルエンコーディング版のファイル名にサフィックス .lc、 UTF-8 エンコーディング版にサフィックス .utf8、 RACE エンコーディング版にサフィックス .race をつけるとします。 すると次のような Makefile を書くことにより、ローカルエンコーディング版を 更新したら make を実行するだけで変換を自動的に行うことができます。

For example, let's assume that a file in local encoding has the suffix .lc, a UTF-8 encoding file the suffix .utf8 and a RACE encoding version file the suffix tt>.race. Then the following type of Makefile could be written to allow automatic conversion using make when a file in local encoding is updated.

.SUFFIXES: .lc .utf8 .race

.lc.utf8:
	mdnconv -in $(LOCALCODE) -out UTF-8 $(NORMALIZE) $< > $@
.lc.race:
	mdnconv -in $(LOCALCODE) -out RACE $(NORMALIZE) $< > $@

LOCALCODE = EUC-JP
NORMALIZE = -normalize unicode-form-c -normalize unicode-lowercase

TARGETS = db.foo.utf8 db.bar.race

all: $(TARGETS)

1つの DNS サーバに異なるエンコーディングの複数のゾーンのマスタを させようとした場合、named.conf に複数のエンコーディングを 混在させなくてはならない状況になることがあります。残念ながらこれは mdnconv では無理なので、include ディレクティブ等を使って ファイルを分割し、1つのファイルに複数のエンコーディングが 混在しないようにしてください。

When multiple zone master files with different encoding schemes are attempted in a single DNS server, it may be necessary to include multiple encoding schemes in named.conf. Unfortunately, this cannot be handled with mdnconv so the include directive or similar command must be used to split the file so that each file does not contain multiple encoding schemes.

最後にもう1つ、UTF-5 特有の問題について説明します。

Finally, we will discuss UTF-5 specific problems.


UTF-5 特有の問題

UTF-5 specific problems

DNS サーバで使用するドメイン名のエンコーディングを UTF-5 にした場合には いくつかの問題が生じます。

A number of problems occur when UTF-5 encoding is used as the domain name encoding of a DNS server.

ZLD の指定

ZLD specification

UTF-5 は ASCII 互換エンコーディングの一つなので、UTF-5 でエンコードされた ドメイン名はそのままでは従来の ASCII のドメイン名と区別できません。 同じく ASCII 互換エンコーディングの一つである RACE では、ドメイン名の 各ラベルの先頭に特定のプリフィックス (bq--) をつけることによって 従来のドメイン名と (一応) 識別できるのですが、 UTF-5 にはこのような機構がないため、ZLD という概念を使用して従来のドメイン 名との識別を可能にしています。

Since UTF-5 is an ASCII compatible encoding scheme, domain names encoded in UTF-5 cannot be distinguished from regular ASCII domain names. By contrast, RACE, another ASCII compatible encoding scheme, appends (bq--), a prefix, to the beginning of each domain name label to allow differentiation from traditional domain names. But since UTF-5 does not have this feature a concept called ZLD is used to identify traditional domain names.

ZLD (zero level domain) とはドメイン名の最後につける トップレベルドメインのことで、例えば utf5. という トップレベルドメインを作り、 UTF-5 エンコーディングのドメイン名はすべてこのドメインのサブドメインとする ことで、従来のドメイン名との区別を可能にします。実際には このトップレベル ドメインはローカルエンコーディングから UTF-5 エンコーディングへの変換を行う 場所 (現在の mDNkit では dnsproxy) で自動的に付加され、また UTF-5 から ローカルエンコーディングに戻すときに自動的に除去されるので アプリケーションにはこのドメインは見えません。アプリケーションにとっての トップレベルドメインよりさらに上位ドメインに位置するので zero level domain なわけです。もちろん DNS サーバからは ZLD は隠されておらず、したがって DNS サーバの設定では ZLD を意識しなければなりません。

ZLD (zero level domain) is the top level domain appended at the end of a domain name. For example, when a utf5. top level domain is created, all UTF-5 encoded domain names can be made the subdomains of this top level domain making it possible to distinguish them from traditional domain names. Since this top level domain is automatically added to the area (dnsproxy in current mDNkit) where conversion from local encoding to UTF-5 encoding takes place and is automatically deleted when coding is returned from UTF-5 to local encoding, the application does not see this level. The top level domain to an application is at a still higher level, hence the name zero level domain. ZLD is of course visible to a DNS server, so DNS server settings must take ZLD into account.

さて、このように UTF-5 エンコーディングでは ZLD が必須ですが、 mdnconv によるローカルエンコーディングから UTF-5 エンコーディングへの変換 の際には、ドメイン名の ZLD の部分とそうでない部分を明確に区別する 必要があります。例えば www.ニック.日本.utf5. というドメイン名を UTF-5 に変換すると N7N7N7.J0CBJ0C3J0AF.M5E5M72C.utf5 となります (ただし ZLD は utf5. だとします)。先頭の www は UTF-5 に変換しますが、ZLD 部分は変換しません。このため mdnconv は ZLD がなんであるかをあらかじめ知っておく必要があります。このために -zld というオプションが用意されています。 このオプションは、ゾーンマスタファイル等に書かれたドメイン名が 指定された ZLD にマッチした時に、マッチした部分を出力エンコーディングへの 変換対象から外すという働きをします。ただしドメイン名と ZLD がマッチするのは

Thus ZLD is required in UTF-5 encoding, whereas conversion from local encoding to UTF-5 encoding using mdncon requires that the ZLD part of the domain name is distinguished from other parts. For example when the domain name www.ニック.日本.utf5. is converted to UTF-5, it beccomes N7N7N7.J0CBJ0C3J0AF.M5E5M72C.utf5 (but ZLD is utf5.). Thus mdnconv must know what ZLD is. The option -zld is provided for this reason. When a domain name written in a zone master file or other file matches a specified ZLD, this option removes the matching portion from conversion to output encoding.★マッチした部分を出力エンコーディングへの変換対象から外すという働きをします★ The conditions for a domain name and ZLD match are as follows:

  1. ドメイン名の最後がピリオドで終わっていること
    The domain name ends in a period
  2. ZLD がドメイン名の最後の部分と一致していること
    ZLD matches the last part of the domain name
という条件を満たしているときだけです。例えば ZLD が utf5. だとすると ZLD とマッチするのは次に示す3つのドメイン名の中で最初のものだけです。
For example if ZLD is utf5., only the first of the following three domain names matches ZLD.
www.ニック.日本.utf5.
www.ニック.日本
utf5.ニック.日本.

さらに mdnconv の -auto オプション を併用するとある程度 ZLD を自動付加させることができ、 この場合ゾーンマスタファイルにいちいち ZLD を書く必要がなくなります。 ただし確実に付加できるわけではないので、このオプションには頼らない方が よいでしょう。

Also, if used with the mdnconv option -auto, ZLD is often automatically added in which case there is no need to write ZLD in each zone master file. However, as addition of this option is not guaranteed, it may be best not to rely on it.

単独で出現する ASCII ラベル

Single ASCII labels

mdnconv は、デフォルトでは非 ASCII 文字を1文字以上含むドメイン名のみを 出力エンコーディングに変換します。つまり ASCII のみからなるドメイン名は 変換しません。これは従来の ASCII ドメイン名と多言語ドメイン名を混在させた 時に、ASCII ドメイン名までが UTF-5 などに変換されてしまうのを防ぐための 処置です。

By default, mdnconv converts to output encoding only domain names that contain two or more non-ASCII characters. Consequently, it does not convert domain names that are entirely made up of ASCII characters. This is to prevent ASCII domain names from being converted to UTF-5 when there are both ASCII domain names and multilingual domain names.

ところが多言語ドメイン名の中に ASCII 文字のみから構成されるラベルが ある場合、それが単独でゾーンマスタファイルに出現するとこの処置のために そのラベルが UTF-5 に変換されないという問題が生じます。 例えばドメイン名 www.ニック.日本.utf5. の A レコードを ゾーンマスタファイルに記述するときに、次のように書いてしまうと www の部分が UTF-5 に変換されません。

However, this gives rise to the following problem. A label containing only ASCII characters in a multilingual domain name that occurs independently in the zone master file is not converted to UTF-5. For example when the A record of the domain name www.ニック.日本.utf5. is denoted in the zone master file as shown below the www part is not converted to UTF-5.

$ORIGIN ニック.日本.utf5.
...
www	IN A 10.9.8.7

このような場合、FQDN で記述するなどして、非 ASCII 文字が含まれる ようにしてやる必要があります。

In this case, use FQDN, for example, to add non-ASCII characters.