Windows Subsystem for Android の IPv6 周りをテスト

# サマリー

+ Windows Subsystem for Android の version 2205.40000.14.0 から Advanced networking で IPv6 がサポートされたのでテストした。
+ SLAAC (A=1, M=0, O=0)、Stateful DHCPv6 (A=0, M=1, O=1) のどちらの環境でも接続できた。
+ SLAAC + Stateful DHCPv6 (A=1, M=1, O=1) で複数の IPv6 アドレスがある場合に一時 IPv6 アドレス (RFC 8981) ではなく Stateful DHCPv6 で取得したアドレスの方を送信元に使ってしまうような。。

# 環境

```
> systeminfo /fo csv | ConvertFrom-Csv | select OS* | Format-List

OS Name          : Microsoft Windows 11 Pro Insider Preview
OS Version       : 10.0.25151 N/A Build 25151
```

# host と vm に割り当てられたアドレスの確認

## SLAAC (A=1, M=0, O=0)

```:Host
> ipconfig /all

Ethernet adapter イーサネット 2:

   Physical Address. . . . . . . . . : 10-27-F5-**-**-FA
   IPv6 Address. . . . . . . . . . . : 240d:1a:6:****:58b2:3d52:b33e:ddbc(Preferred)
   IPv6 Address. . . . . . . . . . . : fda1:1c4f:84e6:0:58b2:3d52:b33e:ddbc(Preferred)
   Temporary IPv6 Address. . . . . . : 240d:1a:6:****:3064:9991:498e:9fc5(Preferred)
   Temporary IPv6 Address. . . . . . : fda1:1c4f:84e6:0:3064:9991:498e:9fc5(Preferred)
   Link-local IPv6 Address . . . . . : fe80::58b2:3d52:b33e:ddbc%7(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.10.171(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Saturday, July 9, 2022 10:26:30 PM
   Lease Expires . . . . . . . . . . : Sunday, July 10, 2022 10:26:27 AM
```

```:VM
$ adb shell
windows_x86_64:/ $ ip a show dev wlan0
14: wlan0@bond_wifi: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 10:27:f5:**:**:fa brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.171/24 brd 192.168.10.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 240d:1a:6:****:3064:9991:498e:9fc5/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fda1:1c4f:84e6:0:3064:9991:498e:9fc5/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 240d:1a:6:****:58b2:3d52:b33e:ddbc/64 scope global nodad deprecated noprefixroute
       valid_lft forever preferred_lft 0sec
    inet6 fe80::408a:f81:4438:df/64 scope link stable-privacy
       valid_lft forever preferred_lft forever
```

## Stateful DHCPv6 (A=0, M=1, O=1)

```:Host
> ipconfig /all

Ethernet adapter イーサネット 2:

   Physical Address. . . . . . . . . : 10-27-F5-**-**-FA
   IPv6 Address. . . . . . . . . . . : 240d:1a:6:****::2eb(Preferred)
   Lease Obtained. . . . . . . . . . : Saturday, July 9, 2022 7:44:37 PM
   Lease Expires . . . . . . . . . . : Saturday, July 9, 2022 10:40:35 PM
   Link-local IPv6 Address . . . . . : fe80::58b2:3d52:b33e:ddbc%61(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.10.171(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Saturday, July 9, 2022 7:42:01 PM
   Lease Expires . . . . . . . . . . : Sunday, July 10, 2022 7:44:35 AM
```

```:VM
windows_x86_64:/ $ ip a show dev wlan0
14: wlan0@bond_wifi: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 10:27:f5:**:**:fa brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.171/24 brd 192.168.10.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 240d:1a:6:****::2eb/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fe80::58b2:3d52:b33e:ddbc/64 scope link nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fe80::408a:f81:4438:df/64 scope link stable-privacy
       valid_lft forever preferred_lft forever
```

# IPv6 の接続性の確認

## SLAAC (A=1, M=0, O=0)

```
windows_x86_64:/ $ ping6 -c 3 ipv6.google.com
PING ipv6.google.com(nrt13s55-in-x0e.1e100.net) 56 data bytes
64 bytes from nrt13s55-in-x0e.1e100.net: icmp_seq=1 ttl=116 time=11.8 ms
64 bytes from nrt13s55-in-x0e.1e100.net: icmp_seq=2 ttl=116 time=8.68 ms
64 bytes from nrt13s55-in-x0e.1e100.net: icmp_seq=3 ttl=116 time=8.53 ms

--- ipv6.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 8.532/9.680/11.829/1.524 ms
```

![slaac.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/73089/8a3d6577-2096-588e-68ed-ff5da2f0083c.png)

## Stateful DHCPv6 (A=0, M=1, O=1)

```
windows_x86_64:/ $ ping6 -c 3 ipv6.google.com
PING ipv6.google.com(nrt20s20-in-x0e.1e100.net) 56 data bytes
64 bytes from nrt20s20-in-x0e.1e100.net: icmp_seq=1 ttl=116 time=8.16 ms
64 bytes from nrt20s20-in-x0e.1e100.net: icmp_seq=2 ttl=116 time=8.63 ms
64 bytes from nrt20s20-in-x0e.1e100.net: icmp_seq=3 ttl=116 time=9.91 ms

--- ipv6.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 8.161/8.903/9.918/0.746 ms
```

# SLAAC + Stateful DHCPv6 (A=1, M=1, O=1) で複数のアドレスが設定された環境でテスト

```:Host
> ipconfig /all

Ethernet adapter イーサネット 2:

   Physical Address. . . . . . . . . : 10-27-F5-**-**-FA
   IPv6 Address. . . . . . . . . . . : 240d:1a:6:****::2eb(Preferred)
   Lease Obtained. . . . . . . . . . : Saturday, July 9, 2022 7:29:46 PM
   Lease Expires . . . . . . . . . . : Saturday, July 9, 2022 10:10:38 PM
   IPv6 Address. . . . . . . . . . . : 240d:1a:6:****:58b2:3d52:b33e:ddbc(Preferred)
   IPv6 Address. . . . . . . . . . . : fda1:1c4f:84e6::2eb(Preferred)
   Lease Obtained. . . . . . . . . . : Saturday, July 9, 2022 7:29:47 PM
   Lease Expires . . . . . . . . . . : Sunday, July 10, 2022 7:29:45 AM
   IPv6 Address. . . . . . . . . . . : fda1:1c4f:84e6:0:58b2:3d52:b33e:ddbc(Preferred)
   Temporary IPv6 Address. . . . . . : 240d:1a:6:****:8d86:8cdc:3c44:52c9(Preferred)
   Temporary IPv6 Address. . . . . . : fda1:1c4f:84e6:0:8d86:8cdc:3c44:52c9(Preferred)
   Link-local IPv6 Address . . . . . : fe80::58b2:3d52:b33e:ddbc%7(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.10.171(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Saturday, July 9, 2022 7:25:33 PM
   Lease Expires . . . . . . . . . . : Sunday, July 10, 2022 7:29:45 AM
```

```:VM
windows_x86_64:/ $ ip a show dev wlan0
14: wlan0@bond_wifi: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 10:27:f5:**:**:fa brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.171/24 brd 192.168.10.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 240d:1a:6:****::2eb/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 240d:1a:6:****:8d86:8cdc:3c44:52c9/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fda1:1c4f:84e6::2eb/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fda1:1c4f:84e6:0:8d86:8cdc:3c44:52c9/128 scope global nodad noprefixroute
       valid_lft forever preferred_lft forever
    inet6 240d:1a:6:****:58b2:3d52:b33e:ddbc/64 scope global nodad deprecated noprefixroute
       valid_lft forever preferred_lft 0sec
    inet6 fda1:1c4f:84e6:0:58b2:3d52:b33e:ddbc/64 scope global nodad deprecated noprefixroute
       valid_lft forever preferred_lft 0sec
    inet6 fe80::58b2:3d52:b33e:ddbc/64 scope link nodad noprefixroute
       valid_lft forever preferred_lft forever
```

```
windows_x86_64:/ $ ping6 -c 3 ipv6.google.com
PING ipv6.google.com(nrt20s09-in-x0e.1e100.net) 56 data bytes
64 bytes from nrt20s09-in-x0e.1e100.net: icmp_seq=1 ttl=115 time=7.21 ms
64 bytes from nrt20s09-in-x0e.1e100.net: icmp_seq=2 ttl=115 time=7.78 ms
64 bytes from nrt20s09-in-x0e.1e100.net: icmp_seq=3 ttl=115 time=7.37 ms

--- ipv6.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 7.217/7.459/7.788/0.241 ms
```

![dhcpv6.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/73089/a6ae6c1d-a4b5-8cd6-6a8f-3e99557c8214.png)

# 参考

+ [Update to Windows Subsystem for Android™ on Windows 11 (July 2022)](https://blogs.windows.com/windows-insider/2022/07/06/update-to-windows-subsystem-for-android-on-windows-11-july-2022/)