1
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.

[Joke-RFC] RFC1924 IPv6アドレスのコンパクトな表記方法

Last updated at Posted at 2022-04-07

はじめに

  • この文書は RFC1924 を勉強と好奇心のため適当に訳したものです。
  • 翻訳の正確さは全く保証しません。
  • 誤字誤訳等の指摘はいつでも大歓迎です。

A Compact Representation of IPv6 Addresses(IPv6アドレスのコンパクトな表記方法)

  • Network Working Group
  • Request for Comments: 1924
  • Category: Informational
  • R. Elz
  • University of Melbourne
  • 1 April 1996

Status of this Memo(このメモの位置づけ)

This memo provides information for the Internet community.
This memo does not specify an Internet standard of any kind.
Distribution of this memo is unlimited.

このメモは、インターネットコミュニティーのための情報を提供するものである。
このメモは、いかなる種類のインターネット標準も規定するものではない。
このメモの配布は無制限である。

1. Abstract(概要)

IPv6 addresses, being 128 bits long, need 32 characters to write in the general case, if standard hex representation, is used, plus more for any punctuation inserted (typically about another 7 characters, or 39 characters total).
This document specifies a more compact representation of IPv6 addresses, which permits encoding in a mere 20 bytes.

IPv6アドレスは128ビットであるため、標準的な16進数で表現した場合には一般的には32文字が必要で、さらに区切り文字が挿入される(通常はさらに7文字程度、合計39文字)。
この文書では、IPv6アドレスをよりコンパクトに表現し、わずか20バイトでエンコードできるようにする方法を規定する。

2. Introduction(はじめに)

It is always necessary to be able to write in characters the form of an address, though in actual use it is always carried in binary.
For IP version 4 (IP Classic) the well known dotted quad format is used.
That is, 10.1.0.23 is one such address.
Each decimal integer represents a one octet of the 4 octet address, and consequently has a value between 0 and 255 (inclusive).
The written length of the address varies between 7 and 15 bytes.

アドレスは、実際の使用上では常にバイナリとして扱われるが、文字で表記できることは必須である。
IPバージョン4(IP Classic)では、よく知られたドットで4つに区切られた形式が使用される。
つまり 10.1.0.23 はそのようなアドレスの1つである。
10進数の各整数は4オクテットのアドレスの1オクテット分を表し、0~255の値を持つことになる。
アドレス表記の長さは7~15バイトである。

For IPv6 however, addresses are 16 octets long [IPv6], if the old standard form were to be used, addresses would be anywhere between 31 and 63 bytes, which is, of course, untenable.

しかしIPv6では、アドレスは16オクテットであり [IPv6] 、旧来の標準形式を用いるとアドレスは31〜63バイトにもなり、もちろんこれは受け入れがたいものである。

Because of that, IPv6 had chosen to represent addresses using hex digits, and use only half as many punctuation characters, which will mean addresses of between 15 and 39 bytes, which is still quite long.
Further, in an attempt to save more bytes, a special format was invented, in which a single run of zero octets can be dropped, the two adjacent punctuation characters indicate this has happened, the number of missing zeroes can be deduced from the fixed size of the address.

そのためIPv6ではアドレスを16進数で表現し、区切り文字の使用を半分にすることにした(訳注:2オクテットごとに区切り文字を入れる)。
さらに、より多くのバイトを節約するために、1つのゼロ・オクテットを省略することができる特別な形式が考案され、隣接する2つの区切り文字はこれが起こったことを示し、省略されたゼロの数はアドレスの固定サイズから推測することになる。

In most cases, using genuine IPv6 addresses, one may expect the address as written to tend toward the upper limit of 39 octets, as long strings of zeroes are likely to be rare, and most of the other groups of 4 hex digits are likely to be longer than a single non-zero digit (just as MAC addresses typically have digits spread throughout their length).

多くの場合、本物のIPv6アドレスを使用した場合にはゼロが連続する文字列はまれであり、16進数の他の4桁のグループのほとんどは0以外で1桁の数字よりも長くなる可能性が高いため(MACアドレスが通常その長さ全体に桁があるのと同様)、記述したアドレスは上限である39オクテットに近づくと予想される。

This document specifies a new encoding, which can always represent any IPv6 address in 20 octets.
While longer than the shortest possible representation of an IPv6 address, this is barely longer than half the longest representation, and will typically be shorter than the representation of most IPv6 addresses.

この文書では、任意のIPv6アドレスを常に20オクテットで表現できる新しいエンコーディング方法を規定する。
これはIPv6アドレスの最短表現よりも長いものの、最長の表現の半分よりもほんの少しだけ長い程度であり、一般的にほとんどのIPv6アドレスの表現よりも短くなる。

3. Current formats(現在のフォーマット)

[AddrSpec] specifies that the preferred text representation of IPv6 addresses is in one of three conventional forms.

[AddrSpec] は、IPv6アドレスの望ましいテキスト表現が、3つの形式のうちの1つであると指定している。

The preferred form is x:x:x:x:x:x:x:x, where the 'x's are the hexadecimal values of the eight 16-bit pieces of the address.

望ましい表記は x:x:x:x:x:x:x であり、x はアドレスを8つ分割した16ビットの断片を16進数で表したものである。

Examples:

例:

        FEDC:BA98:7654:3210:FEDC:BA98:7654:3210  (39 characters)

        1080:0:0:0:8:800:200C:417A  (25 characters)

The second, or zero suppressed, form allows "::" to indicate multiple groups of suppressed zeroes, hence:

2つ目はゼロサプレスであり、:: で複数のゼロを省略して表すことができる。

        1080:0:0:0:8:800:200C:417A

may be represented as

これは、以下のようにあらわすことができ

        1080::8:800:200C:417A

a saving of just 5 characters from this typical address form, and still leaving 21 characters.

一般的なアドレス形式よりも5文字少なくなるが、まだ21文字も必要になる。

In other cases the saving is more dramatic, in the extreme case, the address:

また極端な場合には、アドレスが劇的に節約できるケースもある:

        0:0:0:0:0:0:0:0

that is, the unspecified address, can be written as

これは、未指定のアドレスだが、次のように書くことができる

        ::

This is just 2 characters, which is a considerable saving.
However such cases will rarely be encountered.

これはわずか2文字であり、かなりの節約になる。
しかし、このようなケースはめったにないだろう。

The third possible form mixes the new IPv6 form with the old IPv4 form, and is intended mostly for transition, when IPv4 addresses are embedded into IPv6 addresses.
These can be considerably longer than the longest normal IPv6 representation, and will eventually be phased out.
Consequently they will not be considered further here.

3番目の形式は、新しいIPv6形式と古いIPv4形式を混ぜたもので、IPv4アドレスがIPv6アドレスに埋め込まれるときの主に移行用として意図されている。
これらは、通常の最長IPv6形式よりもかなり長くなる可能性があり、最終的には段階的に廃止される予定である。
したがって、ここではこれ以上検討しない。

4. The New Encoding Format(新しいエンコードフォーマット)

The new standard way of writing IPv6 addresses is to treat them as a 128 bit integer, encode that in base 85 notation, then encode that using 85 ASCII characters.

IPv6アドレスの新しい標準的表記方法は、アドレスを128ビットの整数として扱い、それを85進数で表記し、85個のASCII文字を使ってエンコードするというものである。

4.1. Why 85?(なぜ 85?)

2^128 is 340282366920938463463374607431768211456.
85^20 is 387595310845143558731231784820556640625, and thus in 20 digits of base 85 representation all possible 2^128 IPv6 addresses can clearly be encoded.

$2^{128}$ は 340282366920938463463374607431768211456 である。
$85^{20}$ は 387595310845143558731231784820556640625 であり、85進数の20桁で $2^{128}$ のIPv6アドレスのすべてが明確に符号化可能である。

84^20 is 305904398238499908683087849324518834176, clearly not sufficient, 21 characters would be needed to encode using base 84, this wastage of notational space cannot be tolerated.

$84^{20}$ は 305904398238499908683087849324518834176 で明らかに不足しており、84進数でエンコードする場合には21文字が必要となり、このような表記空間の浪費は許されない。

On the other hand, 94^19 is just 30862366077815087592879016454695419904, also insufficient to encode all 2^128 different IPv6 addresses, so 20 characters would be needed even with base 94 encoding.
As there are just 94 ASCII characters (excluding control characters, space, and del) base 94 is the largest reasonable value that can be used.
Even if space were allowed, base 95 would still require 20 characters.

一方、$94^{19}$ は 30862366077815087592879016454695419904 に過ぎず、$2^{128}$ 種類のIPv6アドレスをすべて符号化するには不十分で、94進法でも20文字が必要である。
ASCII文字(制御文字、スペース、delを除いて)は94個しかないので、94進数は使用可能な最大の値である。
仮にスペースが許されたとしても、95進数では20文字が必要になる。

Thus, any value between 85 and 94 inclusive could reasonably be chosen.
Selecting 85 allows the use of the smallest possible subset of the ASCII characters, enabling more characters to be retained for other uses, eg, to delimit the address.

従って、85から94の間のどの値でも合理的に選択することができる。
85を選択すると、ASCII文字の最小のサブセットのみを使用することができ、アドレスの区切りなど他の用途のために多くの文字を確保することができる。

4.2. The Character Set(文字集合)

The character set to encode the 85 base85 digits, is defined to be, in ascending order:

85進数の85種類の数字を符号化するための文字集合を、昇順に定義する:

             '0'..'9', 'A'..'Z', 'a'..'z', '!', '#', '$', '%', '&', '(',
             ')', '*', '+', '-', ';', '<', '=', '>', '?', '@', '^', '_',
             '`', '{', '|', '}', and '~'.

This set has been chosen with considerable care.
From the 94 printable ASCII characters, the following nine were omitted:

この集合は、非常に慎重に選ばれている。
印刷可能なASCII文字94文字のうち、以下の9文字を取り除いた。

'"' and "'", which allow the representation of IPv6 addresses to be quoted in other environments where some of the characters in the chosen character set may, unquoted, have other meanings.

"' は、選択した文字セット内の一部の文字が引用されずに他の意味を持つ可能性がある他の環境において、IPv6アドレスの表現を引用できるようにするものである。

',' to allow lists of IPv6 addresses to conveniently be written, and '.' to allow an IPv6 address to end a sentence without requiring it to be quoted.

また , をIPv6アドレスのリストを容易に記述するために、. をIPv6アドレスを引用せずに文末に記載するために除外した。

'/' so IPv6 addresses can be written in standard CIDR address/length notation, and ':' because that causes problems when used in mail headers and URLs.

IPv6アドレスを標準である「アドレス/長さ」形式のCIDR表記で記述できるように / を、メールヘッダやURLで使用すると問題が発生するため : を除外した。

'[' and ']', so those can be used to delimit IPv6 addresses when represented as text strings, as they often are for IPv4,

[] は、IPv4と同様にIPv6アドレスをテキスト文字列で表現する場合の区切りとして使用することができる。

And last, '\', because it is often difficult to represent in a way where it does not appear to be a quote character, including in the source of this document.

そして最後の \ は、このドキュメントのソースも含めて、引用文字に見えないように表現するのが難しいため。

5. Converting an IPv6 address to base 85.(IPv6アドレスの85進数への変換)

The conversion process is a simple one of division, taking the remainders at each step, and dividing the quotient again, then reading up the page, as is done for any other base conversion.

変換方法は、他の進数変換と同様に、各ステップで余りをとり、商を再び割って、繰り返すだけの簡単なものである。

For example, consider the address shown above

例えば、上記のようなアドレスを考えてみる

        1080:0:0:0:8:800:200C:417A

In decimal, considered as a 128 bit number, that is 21932261930451111902915077091070067066.

128ビット数値を10進数で表すと 21932261930451111902915077091070067066 となる。

As we divide that successively by 85 the following remainders emerge: 51, 34, 65, 57, 58, 0, 75, 53, 37, 4, 19, 61, 31, 63, 12, 66, 46, 70, 68, 4.

それを順次85で割っていくと、51, 34, 65, 57, 58, 0, 75, 53, 37, 4, 19, 61, 31, 63, 12, 66, 46, 70, 68, 4 という余りが求められる。

Thus in base85 the address is:

したがって、85進数でこのアドレスは:

        4-68-70-46-66-12-63-31-61-19-4-37-53-75-0-58-57-65-34-51.

Then, when encoded as specified above, this becomes:

そして、これを上記のように符号化すると、次のようになる:

        4)+k&C#VzJ4br>0wv%Yp

This procedure is trivially reversed to produce the binary form of the address from textually encoded format.

この手順を逆にすれば、テキストエンコードされたアドレスからバイナリ形式のアドレスを生成することができる。

6. Additional Benefit(付加的な利点)

Apart from generally reducing the length of an IPv6 address when encode in a textual format, this scheme also has the benefit of returning IPv6 addresses to a fixed length representation, leading zeroes are never omitted, thus removing the ugly and awkward variable length representation that has previously been recommended.

この方式は、IPv6アドレスをテキスト形式でエンコードする際に一般的に長さを短くする以外に、IPv6アドレスを固定長の表現に戻し、先行するゼロを決して省略しないため、これまで推奨されてきた醜くて厄介な可変長表現を取り除くという利点もある。

7. Implementation Issues(実装上の課題)

Many current processors do not find 128 bit integer arithmetic, as required for this technique, a trivial operation.
This is not considered a serious drawback in the representation, but a flaw of the processor designs.

現在のプロセッサの多くは、この技術に必要な128ビットの整数演算を簡単には行えない。
これは表記法の重大な欠点ではなく、プロセッサの設計上の欠陥と考えられる。

It may be expected that future processors will address this defect, quite possibly before any significant IPv6 deployment has been accomplished.

将来のプロセッサには、IPv6の普及が進む前にこの不具合に対処することが期待される。

8. Security Considerations(セキュリティに関する考察)

By encoding addresses in this form, it is less likely that a casual observer will be able to immediately detect the binary form of the address, and thus will find it harder to make immediate use of the address.
As IPv6 addresses are not intended to be learned by humans, one reason for which being that they are expected to alter in comparatively short timespan, by human perception, the somewhat challenging nature of the addresses is seen as a feature.

このような形でアドレスを符号化することで、傍観者がアドレスのバイナリ形式をすぐに見抜くことができにくくなり、アドレスをすぐに利用することが難しくなる。
IPv6アドレスは人間が覚えることを意図していない、その理由の一つは人間の感覚では比較的短期間で変化することが予想されるからである、そのためアドレスの視認性悪いことが特徴としてあげられる。

Further, the appearance of the address, as if it may be random gibberish in a compressed file, makes it much harder to detect by a packet sniffer programmed to look for bypassing addresses.

さらにアドレスの見た目が、圧縮されたファイルの中のランダムデータのようであるため、バイパスアドレスを探すようにプログラムされたパケットスニファーでの検出を難しくしている。

9. References(参考文献)

   [IPv6]        Internet Protocol, Version 6 (IPv6) Specification,
                 S. Deering, R. Hinden, RFC 1883, January 4, 1996.

   [AddrSpec]    IP Version 6 Addressing Architecture,
                 R. Hinden, S. Deering, RFC 1884, January 4, 1996.

10. Author's Address

   Robert Elz
   Computer Science
   University of Melbourne
   Parkville, Victoria, 3052
   Australia

   EMail: kre@munnari.OZ.AU
1
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
1
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?