# IPv6, V6プラス(IPoE/IPv4 over IPv6)

**URL:** https://forum.ficusonline.com/t/topic/466
**Category:** Server
**Created:** [2022 年 11 月 7 日午前 6:48 UTC](https://forum.ficusonline.com/t/topic/466 "2022-11-07T06:48:11Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)
#### Post date: [2022 年 11 月 7 日午前 6:55 UTC](https://forum.ficusonline.com/t/topic/466/2 "2022-11-07T06:55:55Z")

</div>

### IPv6アドレス

> **[IPv6 address](https://en.wikipedia.org/wiki/IPv6_address)**
>
> An Internet Protocol version 6 address (IPv6 address) is a numeric label that is used to identify and locate a network interface of a computer or a network node participating in a computer network using IPv6. IP addresses are included in the packet header to indicate the source and the destination of each packet. The IP address of the destination is used to make decisions about routing IP packets to other networks.
> IPv6 is the successor to the first addressing infrastructure of the Internet, Int...

### Private network IPv6

> **[Private network | IPv6](https://en.wikipedia.org/wiki/Private_network#IPv6)**
>
> In IPv6, the block fe80::/10 is reserved for IP address autoconfiguration.
> The implementation of these link-local addresses is mandatory, as various functions of the IPv6 protocol depend on them.
> A special case of private link-local addresses is the loopback interface. These addresses are private and link-local by definition since packets never leave the host device.
> IPv4 reserves the entire class A address block 127.0.0.0/8 for use as private loopback addresses. IPv6 reserves the single addres...

### RFC 4193

[RFC 4193: Unique Local IPv6 Unicast Addresses](https://www.rfc-editor.org/rfc/rfc4193#section-3)

```auto
3. Local IPv6 Unicast Addresses

3.1. Format

   The Local IPv6 addresses are created using a pseudo-randomly
   allocated global ID. They have the following format:

      | 7 bits |1| 40 bits | 16 bits | 64 bits |
      +--------+-+------------+-----------+----------------------------+
      | Prefix |L| Global ID | Subnet ID | Interface ID |
      +--------+-+------------+-----------+----------------------------+

   Where:

      Prefix FC00::/7 prefix to identify Local IPv6 unicast
                        addresses.

      L Set to 1 if the prefix is locally assigned.
                        Set to 0 may be defined in the future. See
                        Section 3.2 for additional information.

      Global ID 40-bit global identifier used to create a
                        globally unique prefix. See Section 3.2 for
                        additional information.

      Subnet ID 16-bit Subnet ID is an identifier of a subnet
                        within the site.

      Interface ID 64-bit Interface ID as defined in [ADDARCH].

```

### ローカルIPv6アドレスの作成例

`Prefix`と`L`の箇所はローカルIPの場合 `FD` となります。これに`Global ID`の箇所の40ビット（5バイト）を組合せて`IPv6`のアドレス空間を定義します。

この40ビットは、 **タイムスタンプ** と **マシンID** を組合せた文字列を **SHA-1** アルゴリズムによりハッシュした値から抜出します。

**タイムスタンプ**

```auto
$ date +%s%N
1667828524739484659

```

**ホストマシンID**

```auto
$ cat /var/lib/dbus/machine-id
610cef4946ed46da8f71dba9d66c67fb

```

**タイムスタンプにホストマシンIDを追加してハッシュ（16進数x40桁）**

```auto
$ printf 1667828524739484659610cef4946ed46da8f71dba9d66c67fb | sha1sum
ac4bebe3c52239cffc4909223ac08d16286349e8 -

```

必要なのは40ビット（5バイト）なので、ここから下位の40ビット（10桁分）を抜出します。

**`16286349e8`**

これを`Prefix`と組合せ、`IPv6`のローカルIPアドレス空間を定義します。サブネットを固定するため **`/64`** を追加します。

**`fd16:2863:49e8::/64`**

---

_[View the full topic](https://forum.ficusonline.com/t/topic/466)._
