Upgrade to Pro — share decks privately, control downloads, hide ads and more …

IPv6対応アプリケーション開発

tsuyu23
December 12, 2016

 IPv6対応アプリケーション開発

2016年、大御所の IPv6 対応/ IPv6 対応義務化が目立った。
・Apple: iOS App Store 登録アプリのIPv6対応義務化
・Microsoft: Azure VM およびロードバランサの IPv6 サポート
・AWS:S3, CloudFront のIPv6サポート
アプリケーションも IPv6 対応で作る時代が本格的に到来。
本スライドは、IPv6対応アプリケーションを開発するために必要な考え方、ポイントを完結にまとめ、具体的な対応例として、PHPのサンプルコード、AppleのIPv6対応を解説します。

【IPv6対応の前提】
1. IPアドレス直書き禁止!FQDNを使用する
2. IPアドレスでユーザを識別しない
3. 同時に多数のセッションを張らない
【基本方針】
IPv6対応=IPv6/IPv4の両方で動作させること
シングルソースコードで対応する
【3つのポイント】
1. IPv4/IPv6両対応のプログラミング言語と実行環境を使う
2. 通信処理をIPv4/IPv6の両方に対応させる
3. データとしてIPアドレスを扱う箇所をIPv4/IPv6の両方に対応させる

tsuyu23

December 12, 2016
Tweet

More Decks by tsuyu23

Other Decks in Technology

Transcript

  1. 4 ࠓ೥݄"QQMFͷ
 Ξφ΢ϯε ͔Βɺ"QQ 4UPSFʹࡌͤΔΞϓϦ ͸ɺ*1WPOMZωοτ ϫʔΫͰಈ࡞͠ͳ͍ͱ ͍͚ͳ͍ ΄ͱΜͲͷΞϓϦ͸Կ΋มߋ͠ͳ ͯ͘େৎ෉ͳ͸ͣ

    ΋͠ɺIPv4ݻ༗ͷAPI΍IPΞυϨε Λϋʔυίʔυͯͨ͠Βɺ ʢNetworking Overview ͷʣ ʮSupporting IPv6 DNS64/NAT64 NetworksʯΛಡΜͰରԠͯ͠Ͷ https://developer.apple.com/news/?id=05042016a
  2. 6 ࠓ೥݄͓Αͼ݄ͷ "84ͷΞφ΢ϯε *1Wαϙʔτ։࢝ Amazon S3, S3 Transfer Acceleration CloudFront

    WAF https://aws.amazon.com/jp/blogs/news/now-available-ipv6- support-for-amazon-s3/ https://aws.amazon.com/jp/blogs/aws/ipv6-support-update- cloudfront-waf-and-s3-transfer-acceleration/
  3. 7 ࠷ۙͷྲྀΕ ࠓ೥ɺେޚॴͷ*1WରԠʗ*1WରԠٛ຿ Խ͕໨ཱͬͨ Appleɿ iOS App Store ొ࿥ΞϓϦͷIPv6ରԠٛ຿Խ Microsoftɿ

    Azure VM ͓Αͼϩʔυόϥϯαͷ IPv6 αϙʔτ AWSɿS3, CloudFront ͷIPv6αϙʔτ ΞϓϦέʔγϣϯ΋ IPv6 ରԠͰ࡞Δ࣌୅͕౸དྷ
  4. 16 *1Wͱ*1WͱͰ͸Կ͕
 ҧ͏ͷ͔ʁᶃ ΞυϨεମܥ͕ҟͳΔʢ*1WͷΞυϨεۭؒ͸޿େʣ ྫ *1Wʣ *1W׬શදهʣ EC *1WলུදهʣECʢ3'$४ڌʣ IPv4ΞυϨε

    IPv6ΞυϨε ΞυϨε௕ 32bit 128bit จࣈྻ
 දه දه๏ 8bitͣͭ۠੾Γɺ 10ਐ਺Ͱදه 16bitͣͭ۠੾Γɺ 16ਐ਺Ͱදه ۠੾Γจࣈ . ʢυοτʣ : ʢίϩϯʣ จࣈྻ௕ 15จࣈҎ಺ 39จࣈҎ಺
  5. 17 *1Wͱ*1WͱͰ͸Կ͕
 ҧ͏ͷ͔ʁᶄ ϢχΩϟετΞυϨεͷߏ੒ ΞυϨεར༻ઃܭ *1WͰ͸ɺωοτϫʔΫΞυϨε෦ͷ௕͞Λௐ੔ *1WͰ͸ɺݪଇతʹαϒωοτϓϨϑΟοΫε͸ݻఆ ɹ 8 8

    8 8 8 8 8 8 8 8 8 8 8 8 8 8 αϒωοτ ϓϨϑΟοΫε 64bit ΠϯλʔϑΣΠε ID 64bit ωοτϫʔΫ ΞυϨε 29bit ϗετΞυϨε 3bit Global Routing Prefix n bits Subnet ID 64 bits Interface ID 64-n bits Subnet Prefix ※ɹωοτϚεΫ 29bit
 (255.255.255.248)ͷ৔߹ ̔ ̔ ̔bit IPv4Ͱ͸ऩ༰͢Δ୺຤ͷݟࠐΈ୆਺ʹԠͯ͡࠷దͳେ͖͞ͷ αϒωοτΛઃܭ͍͕ͯͨ͠ɺIPv6Ͱ͸64bitݻఆ
  6. *1Wͱ*1Wͷ઀ଓੑ 20 Internet IPv4ରԠ
 ʢIPv6ඇରԠʣ
 γεςϜ IPv4/IPv6
 ྆ରԠγεςϜ IPv6ରԠ
 ʢIPv4ඇରԠʣ


    γεςϜ (1) (2) (3) IPv4୺຤ IPv4/IPv6
 ྆ରԠ୺຤ IPv6୺຤ IPv4 IPv6 *1W *1W *1W *1W
  7. 24 ͦͷίʔυɺΠέͯͳ͍ʜ ʢʣ ͱ͋Δ1FSMͷϓϩάϥϜ use IO::Socket::IP; $host = “198.51.100.1”; :

    : my $sock = IO::Socket::IP->new( PeerAddr => $host, PeerPort => $port, Proto => 'tcp' ) or die “Error: $!\n”; : :
  8. 25 ͜ͷίʔυɺΠέͯͳ͍ʜ ʢʣ ͱ͋Δ"OESPJEϓϩάϥϛϯάॻ੶ʹ
 ͓͚Διέοτ௨৴ͷαϯϓϧίʔυ public class SocketEx… … …

    ɹɹprivate final static String IP=“192.168.11.12”;//˒มߋඞਢ ྑ͍ࢠ͸ਅࣅͪ͠Όμϝ
  9. Internet 27 ωοτϫʔΫΞΫηεͷ
 ࡞๏ʹ໊લղܾΛ࢖͏ Client Web Server www.example.jp 2001:db8:100::1
 192.0.2.1

    ݖҖDNS Server 198.51.100.53 ᶃ໊લղܾ໰߹ͤ www.example.jp ʁ ᶄΞυϨεԠ౴ www.example.jp 㱺 2001:db8:100::1
 ɹɹ192.0.2.1 ᶅHTTP௨৴ FQDN '2%/Ͱ઀ଓઌΛࢦఆ͠ɺ%/4͔ΒΞυϨεऔಘ
  10. 28 ͳͥ*1ΞυϨε௚ॻ͖͕
 μϝͳͷ͔ ΞϓϦέʔγϣϯ͸ɺ*1ΞυϨεʹґଘ͢΂͖Ͱ͸ͳ͍ ໨త มߋɾվमͷཧ༝ ΞϓϦέʔγϣϯ ػೳͷఏڙ ▪ ۀ຿ཁ݅ͷมߋ

    ▪ αʔϏε಺༰ͷมߋ ▪ ϢʔβϏϦςΟ޲্ɹ…,etc. Πϯϑϥ ࢿݯͷఏڙ ▪ ࢿݯ؅ཧʢIPΞυϨεɺαʔόϥοΫ…ʣ ▪ ੑೳ ޓ͍ʹมߋͷӨڹΛड͚Δ΂͖Ͱ͸ͳ͍ ಉҰγεςϜͰ΋มߋɾվमͷཧ༝ɾ࣌ظ͸ҟͳΔ ྫʣIPΞυϨεͰϢʔβΛࣝผ͢΂͖Ͱ͸ͳ͍
  11. $PPLJF಺ͷ৘ใʹ΋ؾΛ ෇͚Δ 29 ▪ Cookie಺ʹهࡌ͞ΕΔ৘ใͷੜ੒͕IPv4ΞυϨεΛલఏͱ͍ͯ͠Δ࣮૷ ͕ࢄݟ͞ΕΔɻ͜ͷΑ͏ͳΞϓϦέʔγϣϯʹؔͯ͠͸ɺੜ੒ϩδοΫ Λมߋ͢Δඞཁ͕͋Δɻ ▪ Cookie಺ͷ৘ใͱͯ͠IPv4ΞυϨεΛ௚઀ར༻͍ͯ͠Δ࣮૷͕͠͹͠͹ ݟΒΕΔɻಛʹೝূܥγεςϜͳͲͰ͜ͷछͷ৘ใͷऔѻ͍͕ͳ͞Εͯ

    ͍Δ৔߹͕ଟ͍ɻ͜ͷΑ͏ͳ࣮૷Ͱ͸ɺར༻ऀ͕IPv4/IPv6ͷ྆ํͷۭ ؒΛར༻͓ͯ͠ΓɺͲͪΒΛར༻͢Δ͔͕ҰҐʹఆ·Βͳ͍৔߹ͳͲʹ ໰୊͕ൃੜ͢Δɻ͜ͷΑ͏ͳ࣮૷ͷ৔߹ɺ୯७ʹIPv4/IPv6྆ํʹରԠ ͤ͞Δ͜ͱ͕ࠔ೉Ͱ͋Δɻ ग़యɿIPv6ීٴɾߴ౓Խਪਐڠٞձ ηΩϡϦςΟWGɹIPv6ରԠηΩϡϦςΟΨΠυϥΠϯʢୈ1.0൛ʣ
 ɹɹɹhttp://www.v6pc.jp/jp/upload/pdf/swg-IPv6SecurityGuideline_v1.0.pdf
  12. ΞϓϦέʔγϣϯͷ*1W ରԠͷϙΠϯτ 35 Ethernet IPʢv4/v6ʣ TCP / UDP ΞϓϦέʔγϣϯ OS

    ϛυϧ΢ΣΞʗ
 ϑϨʔϜϫʔΫ ΞϓϦέʔγϣϯ OS ϑϨʔϜϫʔΫ HTTP/HTTPS SMTP, SSH,
 ιέοτ௨৴ͳͲ ΫϥΠΞϯτ αʔό ᶃIPv4/IPv6྆ରԠͷ
 ɹϓϩάϥϛϯάݴޠͱ࣮ߦ؀ڥΛ࢖͏ ᶄ௨৴ॲཧΛIPv4/IPv6ͷ
 ɹ྆ํʹରԠͤ͞Δ ᶅσʔλͱͯ͠IPΞυϨεΛ
 ɹѻ͏ՕॴΛIPv4/IPv6ͷ
 ɹ྆ํʹରԠͤ͞Δ
  13. *1ΞυϨεΛෳ਺࣋ͭ͜ͱ ͕͋Δ 41 IPv6 IPv6 IPv4 IPv4 ෳ਺ͷΞυϨεΛ ࣋ͭ͜ͱ͕͋Δ ෳ਺ͷΞυϨεΛ

    ࣋ͭ͜ͱ͕͋Δ ΫϥΠΞϯτ͕ͲͷΞυϨεʹΞΫηε͢Δ͔͸
 αʔόଆͰ͸༧ଌͰ͖ͳ͍ ಛఆͷΞυϨεʹґଘͨ͠γεςϜΛߏ੒͢΂͖Ͱ͸ͳ͍
  14. Internet 42 ωοτϫʔΫΞΫηεͷ
 ࡞๏ʹ໊લղܾΛ࢖͏ʢ࠶ܝʣ Client Web Server www.example.jp 2001:db8:100::1
 192.0.2.1

    ݖҖDNS Server 198.51.100.53 ᶃ໊લղܾ໰߹ͤ www.example.jp ʁ ᶄΞυϨεԠ౴ www.example.jp 㱺 2001:db8:100::1
 ɹɹ192.0.2.1 ᶅHTTP௨৴ FQDN '2%/Ͱ઀ଓઌΛࢦఆ͠ɺ%/4͔ΒΞυϨεऔಘ େࣄ
  15. *1Wͷ໊લղܾᶄ 44 Client Web Server www.example.jp 2001:db8:100::1 example.jpͷ
 ݖҖDNS Server

    ▪ AAAAϨίʔυʢIPv4ͷ AϨίʔυʹ૬౰ʣΛϦ ιʔεϨίʔυʹొ࿥ ᶃ໊લղܾ໰߹ͤ www.example.jp ʁ ᶄAAAAԠ౴ 2001:db8:100::1 ᶅHTTP௨৴ www.example.jp IN AAAA 2001:db8:100::1 www.example.jp IN A 192.0.2.1
  16. 47 ௨৴ॲཧͷิ଍ɿϑΥʔϧ όοΫ ઀ଓͰ͖ͳ͍৔߹ʹผͷ઀ଓઌ΁ͷ઀ଓʹ ੾ସ͑Δಈ࡞ Client Web Server www.example.jp DNS

    Server www.example.jp IN AAAA 2001:db8:100::1 www.example.jp IN A 192.0.2.1 ᶃ໊લղܾ໰߹ͤ www.example.jp ʁ ᶄAAAAԠ౴ 2001:db8:100::1 ɹAԠ౴ 192.0.2.1 ᶅHTTP௨৴ʢIPv6ʣ 2001:db8:100::1 192.0.2.1 2001:db8:ffff::1 198.51.100.1 ᶆHTTP௨৴ʢIPv4ʣ ϑΥʔϧόοΫ
  17. 48 ૝ఆ͞ΕΔϑΥʔϧόοΫ ͷओͳݪҼ αʔόଆͷ
 ໰୊ αʔό͕౰֘ͷαʔϏεΛఏڙ͍ͯ͠ͳ͍ DNSޡొ࿥ɺো֐౳ ܦ࿏ͷ໰୊ ωοτϫʔΫͷ઀ଓੑ͕ࣦΘΕ͍ͯΔ ISPͷෆ۩߹

    ΫϥΠΞϯτ ଆͷ໰୊ αʔό΁ͷ౸ୡੑ͕ͳ͍ΞυϨεΛબ୒͠ ͯ௨৴Λߦ͓͏ͱ͍ͯ͠Δ άϩʔόϧΞυϨεΛ࢖༻͍ͯ͠ΔดҬ ໢
  18. 51 J04ΞϓϦɺ"OESPJE
 Ͱ͸ʜ ϓϥοτϑΥʔϜ͕ఏڙ͢ΔAPIͰ͜ͷลΛରԠ
 㱺 ։ൃऀʹɺ͜ͷลΛҙࣝͤ͞ͳ͍ iOSΞϓϦ ߴϨϕϧωοτϫʔΫϑϨʔϜϫʔΫͷ࢖༻Λਪ঑ WebKitɿWebϖʔδΛಡࠐΉෳࡶͳϓϩηεʹରԠ Cocoa

    URLɿΞϓϦέʔγϣϯͰURLͱࢀরઌͷϦιʔεΛૢ࡞ CFNetwork.Core Servicesɿ͞·͟·ͳωοτϫʔΫλεΫ AndroidΞϓϦ WebɿWebViewʢAndroid.webkit.WebViewʣɺ
 ɹɹɹHttpURLConnectionʢjava.net.HttpURLConnectionʣ WebҎ֎ɿSocketʢjava.net.Socketʣ
  19. 54 *1W*1WΞυϨεൺֱ IPv4ΞυϨε IPv6ΞυϨε ΞυϨε௕ 32bit 128bit จࣈྻ දه දه๏

    8bitͣͭ۠੾Γɺ 10ਐ਺Ͱදه 16bitͣͭ۠੾Γɺ 16ਐ਺Ͱදه ʢলུදه͋Γʣ ۠੾Γจࣈ . ʢυοτʣ : ʢίϩϯʣ จࣈྻ௕ 15จࣈҎ಺ 39จࣈҎ಺ αϒωοτϚεΫʗϓϨϑΟοΫε௕Λ ߟྀ͢Δͱɺ্هʴ”/”ʴ਺ࣈ3จࣈ
  20. 56 *1WΞυϨεͷจࣈྻ௕ *1WΞυϨεͷจࣈྻ௕ɿจࣈ ϓϨϑΟοΫεΛՃຯ͢Δͱɿจࣈ ྫ֎ʢจࣈΛ௒͑Δ͜ͱ͕͋Δʣ ϦϯΫϩʔΧϧΞυϨεʹκʔϯ*%ʢείʔϓ*%ʣΛ
 ෇༩ͯ͠ΠϯλʔϑΣʔεΛࣝผ͢Δ৔߹ ྫʣGFFUI Ұ෦ͷಛघΞυϨε *1WࣹӨΞυϨε౳


    ྫʣGGGG IPv4ࣹӨΞυϨε IPv4 ΞυϨεΛ IPv6 ΞυϨεͱͯ͠දݱ͢Δͨ Ίͷ IPv6 ΞυϨεɻ্Ґ80Ϗοτʹ0ɺ81ʙ96 Ϗοτ໨ʹ1ɺԼҐ32ϏοτʹIPv4ΞυϨεΛຒ ΊࠐΉɻػث಺෦Ͱͷ࢖༻ʹݶΒΕɺύέοτ ͷ࢝఺/ऴ఺ΞυϨεʹ͸࢖ΘΕͳ͍ɻ ग़యɿ
 IPv6ؔ࿈༻ޠू IPv4-mapped(IPv6) address
  21. 61 จࣈྻܕͰѻ͏৔߹ɺ
 ͳͥ׬શදه͔ʁᶃ লུදهͷ··੔ྻͯ͠΋ʜ 2001:db8:0:1::1:1 2001:db8:0:2::1 2001:db8:0:1::50 2001:db8:0:10::1 ੔ྻલ 2001:db8:0:10::1

    2001:db8:0:1::1:1 2001:db8:0:1::50 2001:db8:0:2::1 ੔ྻޙ ΞυϨεঢॱ 2001:db8:0:1::50 2001:db8:0:1::1:1 2001:db8:0:2::1 2001:db8:0:10::1 লུදهͷ
 ੔ྻ͸
 ΞυϨεঢॱͱ
 Ұக͠ͳ͍ ʢ จ ࣈ ྻ ʣ ੔ ྻ ΞυϨε ঢॱ
  22. 62 จࣈྻܕͰѻ͏৔߹ɺͳͥ׬ શදه͔ʁᶄ ੔ྻ͸׬શදهͰߦ͏ 2001:db8:0:1::1:1 2001:db8:0:2::1 2001:db8:0:1::50 2001:db8:0:10::1 ੔ྻલ ੔ྻޙ

    ΞυϨεঢॱ 2001:db8:0:1::50 2001:db8:0:1::1:1 2001:db8:0:2::1 2001:db8:0:10::1 ΞυϨε ঢॱ 2001:0db8:0000:0001:0000:0000:0001:0001 2001:0db8:0000:0002:0000:0000:0000:0001 2001:0db8:0000:0001:0000:0000:0000:0050 2001:0db8:0000:0010:0000:0000:0000:0001 2001:0db8:0000:0001:0000:0000:0000:0050 2001:0db8:0000:0001:0000:0000:0001:0001
 2001:0db8:0000:0002:0000:0000:0000:0001
 2001:0db8:0000:0010:0000:0000:0000:0001 ʢจࣈྻʣ
 ੔ྻ ׬શදه ׬શදهͷ੔ྻ͸
 ΞυϨεঢॱͱ
 Ұக
  23. 69 ίʔσΟϯάͷཹҙ఺ ؔ਺ɺσʔλܕ͸*1W*1W྆ରԠͷ΋ͷΛ࢖༻
 ͢Δ σʔλܕɿจࣈྻܕ ؔ਺ɿ HFU@EOT@SFDPSE  HFUIPTUCZBEES 

    ϥΠϒϥϦɺϑΟϧλΛ༻͍ͯೖྗ஋ݕূɺม׵ ϥΠϒϥϦɿ/FU@*1W ϑΟϧλɿ'*-5&3@7"-*%"5&@*1 gethostbyname() ͸IPv6ඇରԠ
  24. 70 ʲ1)1ʳ໊લղܾ ਖ਼Ҿ͖ EOT@HFU@SFDPSE Ҿ਺Ͱࢦఆͨ͠33ͷ৘ใΛऔಘͯ͠ɺ഑ྻͰฦ͢
 ٯҾ͖ HFUIPTUCZBEES Ҿ਺Ͱࢦఆͨ͠ΞυϨεʹରԠ͢Δϗετ໊Λฦ ͢ //

    www.iajapan.org ͷ IPv6 ΞυϨε (AAAA Ϩίʔυ) Λݕࡧ $result = dns_get_record('www.iajapan.org', DNS_ALL); $result = gethostbyaddr(‘192.168.0.1'); $result = gethostbyaddr(‘2001:db8:0:1::1:1');
  25. 71 ʲ1)1ʳΞυϨεॲཧ 1&"3/FU@*1W *1WΞυϨεʹؔ͢ΔॲཧΛߦ͏ IUUQQFBSQIQOFUQBDLBHF/FU@*1W ԼهͷΑ͏ͳϝιουΛఏڙ͢Δ DIFDL*1W  *1WͷΞυϨε͔ݕূ DPNQSFTT

     *1ΞυϨεͷ୹ॖ VODPNQSFTT  *1ΞυϨεͷ৳௕ JT*O/FUNBTL  *1͕ࢦఆͨ͠ΞυϨεۭؒʹ
 ɹɹɹɹɹɹɹɹ͋Δ͔Ͳ͏͔Λௐ΂Δ
  26. 72 4BNQMFॲཧϑϩʔ ཤྺॻࠐΈ ཤྺҰཡදࣔɾूܭ ઀ଓݩΞυϨεΛऔಘ DBʹϨίʔυ௥Ճ ʢINSERTʣ ֨ೲઌͷDBͷσʔλܕ͕ จࣈྻͷ৔߹͸ɺলུදه Λ׬શදهʹల։

    Ϣʔβೖྗ஋͔Β੔ྻΩʔɺ ঢॱʗ߱ॱɺूܭϑϥάΛ औಘ Ϣʔβೖྗ஋ʹै͍ɺDB ͔ΒཤྺΛಡΈࠐΈɺঢॱ ʗ߱ॱɺूܭͯ͠දࣔ
  27. 73 4BNQMFίʔυղઆ ʢʣ <?php require_once 'settings.php'; require_once 'modules.php'; $now =

    date('Y/m/d H:i:s'); $array_access = array ( 'source_addr' => filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP), 'source_port' => filter_input(INPUT_SERVER, 'REMOTE_PORT', FILTER_VALIDATE_INT), 'server_addr' => filter_input(INPUT_SERVER, 'SERVER_ADDR', FILTER_VALIDATE_IP), 'access_time' => $now, ); $logging = write_history($array_access); index.php filter_input() ͰϢʔβೖྗ஋ ͕IPΞυϨεܗࣜͰ͋Δ͜ͱ Λݕূ ؔ਺Խͨ͠ΞΫηεཤྺॻ ࠐΈΛݺͼग़͠
  28. 74 4BNQMFίʔυղઆ ʢʣ $sort_mode = array ( 'key' => filter_input(INPUT_GET,

    'sort_key', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/(^access_date$|^source_addr$|^source_port$|^count$)/'))), 'desc' => filter_input(INPUT_GET, 'desc', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/(^desc$|^asc$)/'))), 'count' => filter_input(INPUT_GET, 'count', FILTER_VALIDATE_INT, array('options' => array('min_range' => 0, 'max_range' => 1))), ); if (!$sort_mode['key']){ $sort_mode['key'] = 'access_date'; } $history = display_history($sort_mode); ?> ʙҎԼɺHTML෦෼ʹׂ͖ͭѪʙ index.php ؔ਺Խͨ͠ΞΫηεཤྺද ࣔΛݺͼग़͠
  29. 75 4BNQMFίʔυղઆ ʢʣ <?php // ////////////////////////// // ཤྺॻࠐΈؔ਺ function write_history

    ($array_access) { global $DSN; // ========================================== // DBͷσʔλܕ͕varcharͷ৔߹ʹ͸ɺলུදهΛ׬શදهʹల։ // ========================================== if (constant('STORE_TYPE') !== 'INET') { require_once 'Net/IPv6.php'; if (Net_IPv6::checkIPv6($array_access['source_addr'])) { $source_addr = Net_IPv6::uncompress($array_access['source_addr'], TRUE); } else { $source_addr = $array_access['source_addr']; } } modules.php Net_IPv6::checkIPv6() Ͱม਺ ͕IPv6ΞυϨεͰ͋Δ͜ͱΛ ݕূ লུදهΛ׬શදهʹ ల։ʢୈ2Ҿ਺ΛTRUE ʹ͢Δ͜ͱͰ׬શදهʣ STORE_TYPE ͸ɺ͜ͷϓ ϩάϥϜͰಠࣗʹఆٛ
  30. 76 4BNQMFίʔυղઆ ʢʣ $query = 'INSERT INTO access_history ( access_date,

    source_addr, source_port) VALUES (now(), :ip, :port)'; if ($dbh = new PDO($DSN)) { $sth = $dbh->prepare($query); $sth->execute(array(':ip' => $array_access['source_addr'], ':port' => $array_access['source_port'])); $err_code = $sth->errorCode(); if ($err_code === '00000'){ return OK; } else { return WRITE_ERROR; } } else { echo "DB connection error"; return OPEN_ERROR; } } modules.php
  31. 77 4BNQMFίʔυղઆ ʢʣ // ///////////////////////// // ཤྺදࣔˍΞΫηε਺ूܭؔ਺ function display_history ($sort_mode)

    { global $DSN; if ($sort_mode['count']){ // ूܭ࣌ͷΫΤϦ࡞੒ $query = 'SELECT source_addr, count(source_addr) FROM access_history GROUP BY source_addr'; if ($sort_mode['key'] === 'source_addr' || $sort_mode['key'] === 'count' ){ $query .= ' ORDER BY ' . $sort_mode['key']; if ($sort_mode['desc']) { $query .= ' ' . $sort_mode['desc']; } } modules.php ੔ྻ࣌ͷࢦఆ͸ɺ
 ௨ৗͷSQLʢORDER BY Ωʔʣ
  32. 78 4BNQMFίʔυղઆ ʢʣ } else { // ཤྺҰཡ࣌ͷΫΤϦʔ࡞੒ $query =

    'SELECT * FROM access_history'; if ($sort_mode['key'] && $sort_mode['key'] !== 'count' ){ $query .= ' ORDER BY ' . $sort_mode['key']; if ($sort_mode['desc']) { $query .= ' ' . $sort_mode['desc']; } $query .= ' NULLS LAST'; } } modules.php ੔ྻ࣌ͷࢦఆ͸ɺ
 ௨ৗͷSQLʢORDER BY Ωʔʣ
  33. 79 4BNQMFίʔυղઆ ʢʣ // ================================================= // DB઀ଓˍΫΤϦ࣮ߦ // ================================================= $dbh

    = new PDO($DSN); if ($dbh) { $sth = $dbh->prepare($query); $sth->execute(); $result = $sth->fetchAll(); $sth->errorCode(); } else { echo "DB connection error"; } modules.php
  34. 80 4BNQMFίʔυղઆ ʢʣ // ================================================= // ग़ྗ੔ܗ // ================================================= if

    (constant('STORE_TYPE') !== 'INET') { // จࣈྻͰ֨ೲ͞Ε͍ͯΔ৔߹͸ɺলུදهʹ͢ΔͨΊʹϥΠϒϥϦΛݺͼग़͢ require_once 'Net/IPv6.php'; } if ($sort_mode['count']) { $ret_string = '<H2>ΞΫηεूܭ</H2><TABLE border="1"><TR><TH>No.</ TH><TH>઀ଓݩΞυϨε</TH><TH>઀ଓճ਺</TH></TR>'; $size = sizeof($result); for ($loopcnt = 0; $loopcnt < $size; $loopcnt++){ modules.php
  35. 81 4BNQMFίʔυղઆ ʢʣ if (constant('STORE_TYPE') !== 'INET') { // จࣈྻͰ֨ೲ͞Ε͍ͯΔ৔߹͸ɺলུදهʹ͢Δ

    if (Net_IPv6::checkIPv6($result[$loopcnt]['source_addr'])){ $source_addr = Net_IPv6::compress($result[$loopcnt]['source_addr']); } else { $source_addr = $result[$loopcnt]['source_addr']; } } else { $source_addr = $result[$loopcnt]['source_addr']; } $ret_string .= "<TR><TD align='right'>" . ($loopcnt +1) . "</TD><TD>" . $source_addr . "</TD><TD align='right'>" . $result[$loopcnt]['count'] . "</TD></TR>\n"; } $ret_string .= '</TABLE>'; modules.php ׬શදهΛ লུදهʹ ม׵
 ʢݟ΍͢͞ ॏࢹʣ
  36. 82 4BNQMFίʔυղઆ ʢʣ } else { $ret_string = '<H2>ΞΫηεཤྺ</H2><TABLE border="1"><TR><TH>No.</

    TH><TH>઀ଓ೔࣌</TH><TH>઀ଓݩΞυϨε</TH><TH>઀ଓݩϙʔτ൪߸</ TH></TR>'; $size = sizeof($result); for ($loopcnt = 0; $loopcnt < $size; $loopcnt++){ if (constant('STORE_TYPE') !== 'INET') { // จࣈྻͰ֨ೲ͞Ε͍ͯΔ৔߹͸ɺলུදهʹ͢Δ if (Net_IPv6::checkIPv6($result[$loopcnt]['source_addr'])){ $source_addr = Net_IPv6::compress($result[$loopcnt]['source_addr']); } else { $source_addr = $result[$loopcnt]['source_addr']; } } else { $source_addr = $result[$loopcnt]['source_addr']; } modules.php ׬શදهΛলུ දهʹม׵
 ʢݟ΍͢͞ॏࢹʣ
  37. 83 4BNQMFίʔυղઆ ʢʣ $ret_string .= "<TR><TD align='right'>" . ($loopcnt +1)

    . "</TD><TD>" . $result[$loopcnt]['access_date'] . "</TD><TD>" . $source_addr . "</TD><TD align='right'>" . $result[$loopcnt]['source_port'] . "</TD></TR>\n"; } $ret_string .= '</TABLE>'; } return $ret_string; } ?> modules.php
  38. 86 ιέοτ௨৴ʁ ΫϥΠΞϯτ ʢ*1W*1WΛ໰Θͣʣ೚ҙͷ
 ϗετɺϙʔτʹରͯ͠ιέοτ
 ઀ଓ͠ɺαʔόͱͷؒͰσʔλΛ
 ૹड৴ αʔό ʢ*1W*1WΛ໰Θͣʣ೚ҙͷϙʔτͰιέοτ઀ଓΛ଴ͪ
 ड͚ɺ઀ଓͨ͠ΫϥΠΞϯτͱͷ


    ؒͰσʔλΛૹड৴ ෳ਺ͷιέοτΛੜ੒͢Δ
 σϡΞϧελοΫରԠ
 αʔόϓϩάϥϜ αʔό ϓϩηε IPv6 IPv4 αʔό
 ϓϩάϥϜ ىಈ ઀ଓ ઀ଓ IPv6 IPv4 αʔόଆαϯϓϧίʔυ͸ׂѪ
  39. 87 ΫϥΠΞϯτϓϩάϥϜͷ ϙΠϯτ ϑΥʔϧόοΫɿ઀ଓͰ͖ͳ͍৔߹ʹผͷ ઀ଓઌ΁ͷ઀ଓʹ੾ସ͑Δಈ࡞ ઀ଓઌΞυϨε৘ใΛϦετͰऔಘ͠ɺॱʹͨͲΔ Client Web Server www.example.jp

    DNS Server www.example.jp IN AAAA 2001:db8:100::1 www.example.jp IN A 192.0.2.1 ᶃ໊લղܾ໰߹ͤ www.example.jp ʁ ᶄAAAAԠ౴ 2001:db8:100::1 ɹAԠ౴ 192.0.2.1 ᶅHTTP௨৴ʢIPv6ʣ 2001:db8:100::1 192.0.2.1 2001:db8:ffff::1 198.51.100.1 ᶆHTTP௨৴ʢIPv4ʣ ϑΥʔϧόοΫ
  40. 88 ίʔσΟϯάͷཹҙ఺ ؔ਺ɺσʔλܕ͸*1W*1W྆ରԠͷ΋ͷΛ࢖༻
 ͢Δ σʔλܕɿจࣈྻܕ ؔ਺ɿ HFU@EOT@SFDPSE  HFUIPTUCZBEES 

    ϥΠϒϥϦɺϑΟϧλΛ༻͍ͯೖྗ஋ݕূɺม׵ ϥΠϒϥϦɿ/FU@*1W ϑΟϧλɿ'*-5&3@7"-*%"5&@*1 gethostbyname() ͸IPv6ඇରԠ
  41. 90 4BNQMFίʔυղઆ ʢʣ <?php $IS_DEBUG = 0; $host = filter_input(INPUT_GET,

    'host'); $port = filter_input(INPUT_GET, 'port', FILTER_VALIDATE_INT); if ($host && $port){ $addresses = array(); if ($host_addr = filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)){ $addresses[0]['domain'] = AF_INET6; $addresses[0]['address'] = $host_addr; } elseif ($host_addr = filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)){ $addresses[0]['domain'] = AF_INET; $addresses[0]['address'] = $host_addr; ▪ ϑΟϧλΛ༻͍ͯม਺͕IPv6/IPv4 ΞυϨε͔൑அ ▪ ΞυϨε͔ΒϓϩτίϧʹԠͨ͡ϓϩτίϧϑΝϛϦΛઃఆ
  42. 91 4BNQMFίʔυղઆ ʢʣ } else { $host_list = dns_get_record($host); $size

    = sizeof($host_list); for ($loopcnt = 0; $loopcnt < $size; $loopcnt++){ if ($host_list[$loopcnt]['type'] === 'AAAA'){ $addresses[$loopcnt]['domain'] = AF_INET6; $addresses[$loopcnt]['address'] = $host_list[$loopcnt]['ipv6']; } else { $addresses[$loopcnt]['domain'] = AF_INET; $addresses[$loopcnt]['address'] = $host_list[$loopcnt]['ip']; } } } $size = sizeof($addresses); $message = "઀ଓઌϗετ໊ " . $host . " ϙʔτ൪߸ " . $port . "<BR>\n"; ϗετ໊ͷ৔߹ʹ͸DNS͔Β ΞυϨεΛϦετͰऔಘ ▪ Ϧετͷ਺͚ͩɺΞυϨεΛऔಘ͠઀ଓઌީิͱ͢Δ ▪ IPv6 ͸ AAAA ϨίʔυɺIPv4 ͸ A Ϩίʔυʹ֨ೲ gethostbyname()͸ɺ IPv6ඇରԠ
  43. 92 4BNQMFίʔυղઆ ʢʣ $connect_flag = 0; for ($loopcnt = 0;

    $loopcnt < $size && $connect_flag === 0; $loopcnt++){ if (($socket = socket_create($addresses[$loopcnt]['domain'], SOCK_STREAM, SOL_TCP)) === FALSE){ $error_code = socket_last_error(); $error_msg = socket_strerror($error_code); $message .= "connect to " . $addresses[$loopcnt]['address'] . "<BR>\n"; $message .= 'socket create error: [' . $error_code . '] ' . $error_msg . "<BR>\n"; } else { $message .= 'socket connect (' . ($loopcnt +1) . ') : ' . $addresses[$loopcnt] ['address'] . " port: " . $port . "<BR>\n"; ιέοτ࡞Δ
  44. 93 4BNQMFίʔυղઆ ʢʣ if (socket_connect($socket, $addresses[$loopcnt]['address'], $port)){ $connect_flag = 1;

    $response = socket_read($socket, 1024); $message .= "αʔό͔Βͷϝοηʔδɿ" . '<div style="margin: 10px">' . $response . '</div>' . "<BR>\n"; } else { $error_code = socket_last_error(); $error_msg = socket_strerror($error_code); $message .= 'socket connect error: [' . $error_code . '] ' . $error_msg . "<BR>\n"; } socket_close($socket); } } } else { $message = "઀ଓઌϗετ໊ " . $host . " ΋͘͠͸ϙʔτ൪߸ " . $port . "͕ೖྗ͞ Ε͍ͯ·ͤΜ"; } ઀ଓ͢Δ ੾அ͢Δ
  45. 94 4BNQMFίʔυղઆ ʢʣ <html> <head> <meta charset="UTF-8"> <title>Socket௨৴ΫϥΠΞϯτʢσϡΞϧελοΫ൛ʣ</title> </head> <body>

    <H1>Socket௨৴ΫϥΠΞϯτʢσϡΞϧελοΫ൛ʣ</H1> <form action="<?php echo filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)?>" method="GET"> ઀ଓઌϗετ <input type='text' name='host' value='<?php echo $host; ?>'> ϙʔτ൪߸ <input type='text' name='port'value='<?php echo $port; ?>'> <input type="submit" value="࣮ߦ͢Δ"> </form> <HR> <?php echo $message; ?> </body> </html>
  46. 96 ࠓ೥݄ͷAppleͷ
 Ξφ΢ϯε  ͔Βɺ"QQ4UPSF ʹࡌͤΔΞϓϦ͸ɺ
 IPv6-only ωοτϫʔΫͰಈ ࡞͠ͳ͍ͱ͍͚ͳ͍ ΄ͱΜͲͷΞϓϦ͸Կ΋


    มߋ͠ͳͯ͘େৎ෉ͳ͸ͣ ΋͠ɺ*1W ݻ༗ͷ "1* ΍ *1Ξ υϨεΛϋʔυίʔυ͍ͯͨ͠ ΒɺʢNetworking Overview ͷʣʮSupporting IPv6 DNS64/NAT64 NetworksʯΛ ಡΜͰରԠͯ͠Ͷ https://developer.apple.com/news/?id=05042016a
  47. IPv IPv6 97 %/4/"5ͬͯ Կʁ *1W Λϕʔεʹ *1W ΁ͷΞΫηεΛม׵ͤ͞Δ࢓૊Έ %/4

    Ͱ %/4Ԡ౴ͷ *1W ΞυϨεΛ *1WΞυϨεʹม׵ /"5 Ͱ௨৴Λม׵ %/4/"5؀ڥͷ*1Wͱͷ௨৴࣌ͷྲྀΕ  ΫϥΠΞϯτ
 ʢIPv6ʣ DNS64
 ʢΩϟογϡ
 DNSαʔόʣ ݖҖDNS
 αʔό ᶃDNS໰߹ͤ ᶄDNS໰߹ͤ ᶅԠ౴ ᶆDNSԠ౴
 ʢIPv4 ΞυϨεʣ ᶈDNSԠ౴
 ʢIPv6 ΞυϨεʣ ᶇDNSԠ౴Λม׵
 IPv4 㱺 IPv6 NAT64
 ήʔτ΢ΣΠ Web
 αʔό
 ʢIPv4ʣ ᶋϦΫΤετ
 ʢIPv4ʣ ᶌϨεϙϯε
 ʢIPv4ʣ ᶉϦΫΤετ
 ʢIPv6ʣ ᶎϨεϙϯε
 ʢIPv6ʣ ᶊϓϩτίϧม׵
 IPv6 㱺 IPv4 ᶍϓϩτίϧม׵
 IPv4 㱺 IPv6
  48. 101 "QQMF/FUXPSLJOH 0WFSWJFX ͬͯԿʁ "QQMFࣾͷ։ൃऀ޲͚αΠτͷυΩϡϝϯτίʔ φʔʹܝࡌ͞Ε͍ͯΔυΩϡϝϯτ ೔ຊޠ൛͋ΓʮωοτϫʔΩϯά ΦʔόʔϏϡʔʯ IUUQTEFWFMPQFSBQQMFDPNKQEPDVNFOUBUJPO /FUXPSLJOH*OUFSOFU8FC$PODFQUVBM/FUXPSLJOH0WFSWJFX

    *OUSPEVDUJPO*OUSPEVDUJPOIUNM ωοτϫʔΫϕʔεͷιϑτ΢ΣΞ։ൃ͢Δ
 ࡍʹɺ௨৴଎౓ɺ઀ଓੑɺ৴པੑͳͲɺঢ়گͷ
 มԽʹ௥ਵͰ͖ΔΑ͏ʹ͢Δํ๏Λղઆͨ͠
 จॻ
  49. 102 /FUXPSLJOH 0WFSWJFXͷߏ੒ ωοτϫʔΫ௨৴ʹ͍ͭͯ ݱ࣮తͳωοτϫʔΫͷઃܭ ωοτϫʔΫॲཧͷཁ݅ͷධՁ ωοτϫʔΫαʔϏεͷ୳ࡧͱ޿ࠂ ΢Σϒ΍ϚϧνϝσΟΞ
 ίϯςϯπͷදࣔ )551)5514ཁٻͷॲཧ

    ιέοτ΍
 ιέοτετϦʔϜͷ࢖͍ํ ωοτϫʔΫ௨৴ͷ
 ηΩϡϦςΟػೳ ϓϥοτϑΥʔϜಛ༗ͷ
 ωοτϫʔΫٕज़ ωοτϫʔΫॲཧʹ͓͍ͯ
 ൜͕ͪ͠ͳޡΓͷճආ IPv6 DNS64/NAT64 
 ωοτϫʔΫͷαϙʔτ ▪ IPv6 Λ࠾༻͢Δཧ༝ ▪ DNS64/NAT64 ʹΑΔҠߦ
 ϫʔΫϑϩʔ ▪ IPv6 ͓Αͼ App Store ͷཁ݅ ▪ IPv6 Λαϙʔτ͢Δࡍͷ
 Α͋͘Δোน ▪ IPv6 DNS64/NAT64 ͷޓ׵ੑͷอূ ▪ ؔ࿈৘ใ
  50. 103 *1WΛ࠾༻͢Δཧ༝ IPv4 ΞυϨεͷރׇ *1WΑΓ΋ޮ཰తͳ *1W NAT ͷඞཁ͕ͳ͍ ؆ૉԽ͞ΕͨϔομΛ࢖͏͜ͱʹΑΓɺϧʔςΟϯάͷߴ଎Խ͕Մೳ ωοτϫʔΫ͕அยԽ͞Εͳ͍

    ۙྡΞυϨεղܾͷͨΊͷϒϩʔυΩϟετΛճආ ( ͷಋೖ ( ͸ύέοτަ׵ͷΈΛϕʔεɺ*1WΞυϨεڙڅ͸ݶք ϚϧνϝσΟΞαʔϏεͷޓ׵ੑ Ұ෦ͷαʔϏεϓϩόΠμ͕࢖͏*.4ʢ*1.VMUJNFEJB$PSF/FUXPSL4VCTZTUFNʣ͸ɺ *1Wͱ͔͠ޓ׵ੑ͕ͳ͍ ྉۚ αʔϏεϓϩόΠμʔ͸طଘͷ IPv4 ωοτϫʔΫͷαϙʔτΛଓ͚Δ͜ͱʹΑΓɺ
 ௥Ճͷӡ༻ίετͱ؅ཧίετ͕͔͔Δ IPv4ωοτϫʔΫͱIPv6ωοτϫʔΫΛൺֱͯ͠ॻ͔Ε͍ͯΔ͕ɺ
 طଘωοτϫʔΫͷҠߦ͸ߟྀͯ͠ͳ͍Α͏ʹײ͡Δ
  51. 104 %/4/"5 ʹΑΔ ҠߦϫʔΫϑϩʔ ϓϩόΠμʔͱͯ͠ཧ૝తͳͷ͸ɺ*1W ωοτ
 ϫʔΫͷαϙʔτΛഇࢭ͢Δ͜ͱ
 ʢཧ༝͸ *1W ઀ଓͷҡ࣋ʹίετ͕͔͔ΔͨΊʣ

    㱺ͦΕΛ΍ͬͯ͠·͏ͱɺ*1WωοτϫʔΫʹ
 ɹ ΫϥΠΞϯτ͕ΞΫηεͰ͖ͳ͘ͳΔ ओཁͳωοτϫʔΫϓϩόΠμʔͷେ൒͸ DNS64/NAT64 ʹ ΑΔҠߦϫʔΫϑϩʔΛ࣮૷ ͱ "QQMF ͸༧ଌ
  52. 105 *1W ͓Αͼ "QQ4UPSF ͷཁ݅ ΞϓϦέʔγϣϯͰʢIPv6 DNS64/NAT64 
 ωοτϫʔΫͱͷʣޓ׵ੑΛอূ͢Δ͜ͱ ఆظతʹճؼςετ͢Δ͜ͱ͕ॏཁ

    ͜ͷจॻ্ɺApp Store Ͱͷల։ͷཁ݅͸ɺ
 DNS64/NAT64؀ڥͰಈ࡞͢Ε͹͍͍
 ʢIPv6ͷαʔόͱͷ઀ଓੑ͸ཁٻ͞Ε͍ͯͳ͍ʣ ࣮͸ͪΐͬͱҧ͏ʢޙड़ʣ
  53. 106 *1WΛαϙʔτ͢Δࡍͷ Α͋͘Δোน ϓϩτίϧʹຒΊࠐ·ΕͨIPΞυϨεϦςϥϧ ϓϩτίϧϝοηʔδʹ*1ΞυϨεϦςϥϧؚ͕·ΕͨΓ ϔομʔϑΟʔϧυͷ஋ʹදࣔ͞ΕͨΓ ߏ੒ϑΝΠϧʹຒΊࠐ·ΕͨIPΞυϨεϦςϥϧ ωοτϫʔΫϓϦϑϥΠτ ௨৴Մ൱ͷࣄલνΣοΫΛɺIPΞυϨεϦςϥϧͰ༩͑ΒΕͨ઀ଓઌͰ
 ߦ͍ͬͯΔ

    ௿ϨϕϧωοτϫʔΫ"1*ͷ࢖༻ ιέοτ΍ɺ3"8ωοτϫʔΫ"1* ޡ༻͞Ε͕ͪɺIPv4 ͔͠αϙʔτ͠ͳ͔ͬͨΓ͢Δ খ͞ͳΞυϨεϑΝϛϦετϨʔδίϯςφͷ࢖༻ 32bitҎԼͷΞυϨεετϨʔδίϯςφ͕࢖ΘΕ͍ͯΔ౳ ·ͱΊΔͱɺ௚઀IPΞυϨε͕࢖༻͞ΕͯΔɺIPv6ඇରԠͷ
 API࢖ΘΕͯΔɺΞυϨε͕֨ೲͰ͖ͳ͍ ͷ3఺ʹू໿͞ΕΔ
  54. 107 *1W%/4/"5 ͷޓ׵ੑͷอূ ߴϨϕϧωοτϫʔΫϑϨʔϜϫʔΫͷ࢖༻ ΄ͱΜͲͷ৔߹ɺߴϨϕϧϑϨʔϜϫʔΫͰे෼ 8FC,JUɿ8FCϖʔδΛಡࠐΉෳࡶͳϓϩηεʹରԠ $PDPB63-ɿΞϓϦέʔγϣϯͰ63-ͱࢀরઌͷϦιʔεΛૢ࡞ $'/FUXPSL$PSF4FSWJDFTɿ͞·͟·ͳωοτϫʔΫλεΫ IPΞυϨεϦςϥϧΛ࢖Θͳ͍ ϓϦϑϥΠτͳ͠ͷ઀ଓ

    దੑαΠζͷετϨʔδίϯςφͷ࢖༻ ιʔείʔυΛνΣοΫ͠ɺIPv6 DNS64/NAT64ͱ
 ඇޓ׵ੑ͕ͳ͍͔֬ೝ IPv4ݻ༗ͷAPIΛ࢖༻͍ͯ͠ͳ͍͔֬ೝ IPv6 DNS64/NAT64 ͷޓ׵ੑͷఆظతͳςετ .BD୆Ͱ%/4/"5ͷݕূ͕Ͱ͖ΔΑ͏ʹػೳΛఏڙ IPv6 DNS64/NAT64 ؀ڥԼͰ΋ಈ࡞͢ΔͨΊʹ͸্هରԠ͕ඞཁ
 ্هରԠ͸ɺΞϓϦέʔγϣϯIPv6ରԠڞ௨ͷ΋ͷ ͱ Apple ؀ڥݻ༗ͷ΋ͷ ͕ࠞࡏ ϗετ໊ɾFQDNΛ࢖͏ ਖ਼
  55. 108 ʲࢀߟʳΞϓϦέʔγϣϯͷ*1WରԠ ͷϙΠϯτ Ethernet IPʢv4/v6ʣ TCP / UDP ΞϓϦέʔγϣϯ OS

    ϛυϧ΢ΣΞʗ
 ϑϨʔϜϫʔΫ ΞϓϦέʔγϣϯ OS ϑϨʔϜϫʔΫ HTTP/HTTPS SMTP, SSH,
 ιέοτ௨৴ͳͲ ΫϥΠΞϯτ αʔό ᶃIPv4/IPv6྆ରԠͷ
 ɹϓϩάϥϛϯάݴޠͱ࣮ߦ؀ڥΛ࢖͏ ᶄ௨৴ॲཧΛIPv4/IPv6ͷ
 ɹ྆ํʹରԠͤ͞Δ ᶅσʔλͱͯ͠IPΞυϨεΛ
 ɹѻ͏ՕॴΛIPv4/IPv6ͷ
 ɹ྆ํʹରԠͤ͞Δ
  56. 109 /FUXPSLJOH0WFSWJFXΛಡΈղ͍ͨ ݁Ռᶃ "QQMF ͸ ίετͷࢹ఺Λॏࢹͯ͠ɺαʔϏεϓϩόΠμʔ͕
 *1W %/4/"5 Λબ୒͢Δͱ༧ଌ DNS64/NAT64

    Ͱಈ͚͹OK ͱߟ͑ͨ
 㱺 ɾDNS64/NAT64 Ͱͷಈ࡞Λ App Store ͷཁ݅ʹͨ͠
 ɹ ɾMacʹݕূ؀ڥΛఏڙ͢ΔػೳΛ࣮૷ ͔͠͠ɺຊདྷɺΞϓϦέʔγϣϯʹٻΊΒΕΔ͜ͱ͸ɺ
 IPv6 ؀ڥͰ΋ IPv4 ؀ڥͰ΋ IPv6/IPv4ࠞࡏ؀ڥʢσϡΞϧελοΫʣͰ΋ಈ࡞͢Δ͜ͱ Apple ͷ͜ͷߟ͑Ͱ͸ຬͨͤͳ͍
  57. 110 /FUXPSLJOH0WFSWJFXΛಡΈղ͍ͨ ݁Ռᶄ ࣮ࡍͷରԠͱͯ͠͸ *1Wαϙʔτ࣌ͷΑ͋͘Δোน ௚઀*1ΞυϨε͕࢖༻͞ΕͯΔ *1WඇରԠͷ"1*࢖ΘΕͯΔ ΞυϨεϑΝϛϦετϨʔδίϯςφͷ༰ྔ͕ෆ଍ ͕ੜ͡ͳ͍Α͏ʹ͢ΔͨΊʹ ΞϓϦέʔγϣϯ*1WରԠڞ௨ͷ

    1. IPΞυϨεϦςϥϧͰ͸ͳ͘ɺϗετ໊ɾFQDNͷ࢖༻ 2. దਖ਼αΠζͷετϨʔδίϯςφͷ࢖༻ 3. IPv4 ݻ༗ͷAPIΛ࢖༻͍ͯ͠ͳ͍͔֬ೝ ͱ "QQMF ݻ༗ͷ 4. ߴϨϕϧωοτϫʔΫϑϨʔϜϫʔΫͷ࢖༻ 5. ϓϦϑϥΠτͳ͠ͷ઀ଓ Λߦ͍ɺݕূ͢Δ͜ͱΛٻΊ͍ͯΔ ্ه 1ʙ5 ʹै͍࣮૷͢Ε͹ɺDNS64/NAT64؀ڥ͚ͩͰͳ͘ɺσϡΞ ϧελοΫ؀ڥͰ΋ಈ࡞͢Δ
  58. 118 .BD ʹΑΔ %/4/"5ݕূ؀ڥ͸
 ׬੒͕ͨ͠ʜ ͜ΕͰɺ"QQ4UPSF ͕ཁٻ͢Δ *1W %/4/"5 Ͱͷಈ࡞͸ݕূͰ͖Δʢ͸

    ͣʣ ͔͠͠ɺIPv6 ಉ࢜ͷಈ࡞͸ݕূͰ͖ͳ͍ͷͰɺ ৔߹ʹΑͬͯ͸ App Store ͷϨϏϡʔཁ݅Λຬͨͤͳ͍ Let’s Hackʢվ଄ͯ͠ΈΔʣ ݕূͨ͠ओͳਓɿ ɹIPv6ීٴɾߴ౓Խਪਐڠٞձ ΞϓϦέʔγϣϯͷIPv6ରԠݕ౼SWGɹ౻࡚ ஐ޺ࢯɺ౉ล ࿐จ ɹJPNICɹࠤ౻ लथࢯ ࢀߟɿ https://forums.developer.apple.com/message/147579#147579
  59. 119 .BDʹΑΔ %/4/"5ݕূ؀ڥ Λվ଄ᶃ .BDͷ %/4/"5 Λߏ੒͢Διϑτ΢ΣΞ %/4ɿ6OCPVOE ઃఆϑΝΠϧɿFUDDPNBQQMFNJTVOCPVOEDPOG ϧʔλ޿ࠂʢ3"ʣɿSUBEWE

    3%/44Ͱ ϦκϧόͷΞυϨεΛ޿ࠂ ઃఆϑΝΠϧɿFUDDPNBQQMFNJTSUBEWEDPOG ύέοτϑΟϧλɿQG 6QMJOL ͕ *1W͔͠௨৴Ͱ͖ͳ͍ཧ༝ ᶃ ΫϥΠΞϯτʹׂ౰ΔΞυϨε͕ϕϯνϚʔΫΞυϨε
 㱺άϩʔόϧΞυϨεʹมߋ͠ͳ͍ͱɺ֎෦͔Β *1WͰ౸ୡͰ͖ͳ͍ ᶄ VOCPVOEͷઃఆͰ EOTTZOUIBMM͕༗ޮʹͳ͍ͬͯΔ
 㱺*1Wαʔόͷ໊લղܾ΋ %/4 ม׵͞ΕΔ internet ϧʔλ Mac ཧ༝ᶃ 2001:2::/64 UplinkଆI/F
 2001:db8:1::2/64 unbound rtadvd ཧ༝ᶄ
  60. 120 .BDʹΑΔ %/4/"5ݕূ؀ڥ Λվ଄ᶄ վ଄खॱ ᶃ ্ྲྀͷϧʔλʹͯɺΫϥΠΞϯτʹ BEWFSUJTF͢Δ QSFGJYΛɺ
 .BDͷ6QMJOLΞυϨεʹϧʔςΟϯά

    ԼਤͷྫͰ͸ɺECΛ EC΁ϧʔςΟϯά ᶄ FUDDPNBQQMFNJTSUBEWEDPOG Λมߋ ΫϥΠΞϯτʹ BEWFSUJTF͢Δ QSFGJY SEOTTͷ஋Λมߋ ᶅ FUDDPNBQQMFNJTVOCPVOEDPOG Λมߋ EOTTZOUIBMM ͷߦΛ࡟আ JOUFSGBDFJOUFSGBDF<SOETTαʔόͷΞυϨε>ʹมߋ ᶆ VOCPVOE͓Αͼ SUBEWEΛ LJMMͯ͠ىಈ͠௚͠ ஫ҙɿ্هઃఆϑΝΠϧ͸ɺNAT64༗ޮ࣌ͷΈग़ݱ͢Δ /"5 Λແޮʹͨ࣌͠఺Ͱઃఆ͕ॳظԽ͞ΕɺઃఆϑΝΠϧ΋ফࣦ internet ϧʔλ Mac खॱᶄ, ᶅ, ᶆ खॱᶃ 2001:db8:2::/64 UplinkଆI/F
 2001:db8:1::2/64 unbound rtadvd
  61. 123 "QQMFελοϑͷϑΥʔϥϜ΁ͷ౤ߘΛ ಡΉͱʜᶄ "QQϨϏϡʔͰݟ͍ͯΔͷ͸ %/4/"5 ͚ͩͰ͸ͳ͘ɺ *1WUP*1Wͷ ઀ଓੑ΋ݟ͍ͯΔ "QQϨϏϡʔͷωοτϫʔΫߏ੒͸ɺݫີʹ͸ɺ/FUXPSLJOH0WFSWJFXʹ
 ॻ͔Ε͍ͯΔ

    %/4/"5ͱҟͳΔ αʔό͕*1WʹରԠ͍ͯ͠ΔͳΒɺ/"5Ͱม׵ͤ͞ͳ͍Ͱ௚઀௨৴͢΂͠ αʔό͕IPv6ରԠ͍ͯͯ͠΋ɺIPv6Ͱ઀ଓͰ͖ͳ͍͜ͱ͕͋Δ DNSొ࿥໊͕ޡ͍ͬͯΔ DNS͸ਖ਼ͯ͘͠΋ɺαʔό͕ IPv6 Ͱ listen ͍ͯ͠ͳ͍ αʔό͕ IPv6 Ͱ listen ͍ͯͯ͠΋ɺIPv6 ͰϦΫΤετ͕དྷΔͱࣦഊ͢Δ શͯͷαʔόΛνΣοΫ͢Δ͜ͱ ϥΠϒϥϦʹӅ͞Ε͍ͯΔαʔό໊ ଞͷωοτϫʔΫϦΫΤετͷ݁Ռͱͯ͠ App ʹฦ͞ΕΔαʔό໊ HTTP & HTTPS ʹ͓͍ͯ͸ɺଞͷαʔό΁ͷϦμΠϨΫτ DNS ͷ CNAMEϨίʔυ
  62. 124 4ষ·ͱΊ "QQMF͸ɺ64ͷϞόΠϧΩϟϦΞͷಈ͖͔Βɺ͜Ε͔Β͸ *1W͕ϝΠϯͰɺ
 *1W͸/"5ͰΞΫηε͢Δͱ༧ଌ "QQMF͸ɺJ04"QQͷཁ݅ͱͯ͠*1WPOMZ ωοτϫʔΫͰͷಈ࡞Λཁٻ͠ɺ
 ϨϏϡʔʢ৹ࠪʣͰ֬ೝ͍ͯ͠Δ ઀ଓઌ͕ *1Wαʔόͷ৔߹͸ɺ%/4/"5

    ؀ڥͰ ઀ଓઌ͕ *1W αʔόͷ৔߹͸ɺ*1Wͷ௚઀௨৴Ͱ J04"QQ ͷ*1WPOMZωοτϫʔΫͰͷಈ࡞Λ࣮ݱ͢Δʹ͸ /FUXPSLJOH 0WFSWJFXΛࢀߟʹ͢Δͷ͕ྑ͍ J04"QQͷ *1WPOMZωοτϫʔΫͰͷಈ࡞ͷݕূ͸ɺ.BDʹΑΔ %/4 /"5 ͕؆୯ վ଄ͯ͠ *1Wαʔόͱͷ઀ଓੑΛ֬อ͢Ε͹ɺݕূ͕͞Βʹ؆୯ʹͳΔ ϑΥʔϥϜͷ౤ߘ΋ͪΌΜͱಡ΋͏
  63. 127 ·ͱΊᶄ ΞϓϦέʔγϣϯͷ*1WରԠͷجຊํ਑ *1WରԠʹ*1W*1Wͷ྆ํͰಈ࡞ͤ͞Δ͜ͱ γϯάϧιʔείʔυͰରԠ͢Δ ΞϓϦέʔγϣϯͷ*1WରԠͷϙΠϯτ  *1W*1W྆ରԠͷϓϩάϥϛϯάݴޠͱ࣮ߦ؀ڥΛ࢖͏  ௨৴ॲཧΛ*1W*1Wͷ྆ํʹରԠͤ͞Δ

     σʔλͱͯ͠*1ΞυϨεΛѻ͏ՕॴΛ*1W*1Wͷ྆ํʹ
 ରԠͤ͞Δ ɹ "QQMF͸*1W0OMZωοτϫʔΫͰͷಈ࡞Λ"QQ4UPSFͷཁ݅ʹ͠ɺ
 ݕূ؀ڥͷߏங͕༰қʹߦ͑Δ࢓૊ΈΛ.BDʹ౥ࡌͨ͠ ɹ ܾͯ͠೉͘͠ͳ͍ʂ ࠓ೔͔Β։ൃ͢ΔWebαʔϏε͸IPv6ʹରԠͤ͞Α͏ʂ