{"id":4160,"date":"2016-08-27T22:49:12","date_gmt":"2016-08-27T14:49:12","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=4160"},"modified":"2016-08-28T10:26:36","modified_gmt":"2016-08-28T02:26:36","slug":"ios-%e6%b5%8b%e8%af%95%e5%ba%94%e7%94%a8%e5%9c%a8-ipv6-%e7%8e%af%e5%a2%83%e4%b8%8b%e6%98%af%e5%90%a6%e8%83%bd%e5%a4%9f%e6%ad%a3%e5%b8%b8%e5%b7%a5%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=4160","title":{"rendered":"[iOS] \u6d4b\u8bd5\u5e94\u7528\u5728 IPv6 \u73af\u5883\u4e0b\u662f\u5426\u80fd\u591f\u6b63\u5e38\u5de5\u4f5c"},"content":{"rendered":"<p>\u5728<a href=\"https:\/\/blog.qdac.cc\/?p=4155\">\u524d\u9762\u7684\u6587\u7ae0<\/a>\u4e2d\u6211\u4eec\u4e3a\u670d\u52a1\u5668\u5206\u914d\u4e86\u4e00\u4e2a IPv6 \u7684\u5730\u5740\uff0c\u4f46\u662f\u4ec5\u4ec5\u6709\u5b83\u8fd8\u662f\u4e0d\u591f\u7684\u3002\u5c31\u6211\u7684\u5e94\u7528\u73af\u5883\u6765\u8bf4\uff0c\u4e3a\u4e86\u901a\u8fc7\u82f9\u679c\u7684 IPv6 Only \u73af\u5883\u7684\u517c\u5bb9\u6d4b\u8bd5\uff0c\u6211\u9700\u8981\u6211\u7684 Web \u670d\u52a1\u5668\u80fd\u591f\u5728 IPv6 \u7684\u5730\u5740\u4e0a\u8fdb\u884c\u76d1\u542c\u5e76\u8fdb\u884c\u54cd\u5e94\u3002\u6211\u7684 Web \u670d\u52a1\u5668\u4f7f\u7528\u7684\u662f nginx\uff0c\u9ed8\u8ba4\u7684\u7f16\u8bd1\u65b9\u5f0f\u4e0b\uff0c\u5e76\u6ca1\u6709\u542f\u7528 IPv6\uff0c\u6211\u4eec\u9700\u8981\u91cd\u65b0\u4e0b\u8f7d nginx \u6e90\u7801\u5e76\u5728\u8c03\u7528 .\/configure \u65f6\u4f7f\u7528 &#8211;with-ipv6 \u9009\u9879\u8fdb\u884c\u7f16\u8bd1\u540e\u8986\u76d6\u539f\u6765\u7684\u5b89\u88c5\uff08\u6ce8\u610f\u8981\u5148\u505c\u6389 nginx \u670d\u52a1\uff09\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4fee\u6539\u7f51\u7edc\u7684\u914d\u7f6e\uff0c\u5c06\u539f\u6765\u7684<\/p>\n<p style=\"padding-left: 30px;\">listen 80;#\u5982\u679c\u63d0\u4f9b\u670d\u52a1\u7684\u7aef\u53e3\u53f7\u4e0d\u662f80\uff0c\u5219\u4e3a\u5b9e\u9645\u7684\u7aef\u53e3\u53f7\uff0c\u4e0b\u540c<\/p>\n<p>\u66ff\u6362\u4e3a\uff1a<\/p>\n<p style=\"padding-left: 30px;\">listen 80;<\/p>\n<p style=\"padding-left: 30px;\">listen [::]:80 ipv6only=on;<\/p>\n<p>\u7136\u540e\u8c03\u7528 service nginx start \u542f\u52a8 nginx \u670d\u52a1\uff0c\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u5219\u6211\u4eec\u8c03\u7528 netstat -na \u67e5\u770b\u65f6\uff0c\u53ef\u4ee5\u770b\u5230\u5df2\u7ecf\u76d1\u542c :::80 \u7684 tcp \u8bb0\u5f55\u4e86\u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u670d\u52a1\u5668\u7aef\u7684\u51c6\u5907\u5de5\u4f5c\u624d\u7b97\u5f7b\u5e95\u5b8c\u4e8b\u3002\u73b0\u5728\u6211\u4eec\u6765\u5728 OS X \u5ba2\u6237\u7aef\u9a8c\u8bc1\u6211\u4eec\u7684IPv6 \u8bbf\u95ee\u662f\u5426\u6b63\u5e38\uff1a<\/p>\n<ol>\n<li>\u5982\u679c\u5ba2\u6237\u7aef\u6709\u516c\u7f51IP\uff0c\u90a3\u6700\u597d\u4e86\uff0c\u76f4\u63a5\u548c\u524d\u9762\u7684\u6587\u7ae0\u4e00\u6837\uff0c\u7533\u8bf7\u4e00\u4e2a IPv6 \u5730\u5740\uff0c\u7136\u540e\u914d\u7f6e\u4e0b\u5c31\u597d\u3002\u5982\u679c\u6ca1\u6709\uff0c\u5219\u53ef\u4ee5\u5230 6plat \u7533\u8bf7\u4e00\u4e2a IPv6 \u7684 VPN\uff08\u4e0d\u8981\u6307\u671b\u8fd0\u884c\u901f\u5ea6\u6709\u591a\u5feb\uff0c\u6211\u4eec\u53ea\u662f\u8981\u7528\u5b83\u6765\u9a8c\u8bc1\u914d\u7f6e\uff09\uff0c\u6309\u5b98\u7f51\u7684\u6587\u6863\u5b89\u88c5\u5e76\u914d\u7f6e\u540e\u767b\u5f55 VPN\uff0c\u83b7\u53d6\u4e00\u4e2a IPv6 \u5730\u5740\u3002<br \/>\n<a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2016\/08\/6plat.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4161\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2016\/08\/6plat.jpg\" alt=\"6plat\" width=\"254\" height=\"213\" \/><\/a><\/li>\n<li>\u5728 OS X \u4e2d\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\uff0c\u8f93\u5165 \u00a0host \u6211\u4eec\u7684Web\u670d\u52a1\u5668\u57df\u540d\uff0c\u4ee5\u786e\u5b9a\u524d\u9762\u914d\u7f6e\u7684 IPv6 \u7684 AAAA \u5730\u5740\u89e3\u6790\u8bb0\u5f55\u5df2\u7ecf\u751f\u6548\u3002\u6b63\u5e38\u751f\u6548\u540e\u7684\u8bb0\u5f55\u7684\u683c\u5f0f\u7c7b\u4f3c\u4e8e\u4e0b\uff1a\n<pre class=\"lang:delphi decode:true\">:~xxx$ host aaa.bbb.com\r\naaa.bbb.com has address 1.2.3.4\r\naaa.bbb.com has IPv6 address xxx:xxx:xx:xx::xxx<\/pre>\n<\/li>\n<li>\u73b0\u5728\uff0c\u6211\u4eec\u4f7f\u7528 curl \u6765\u5c1d\u8bd5\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff0c\u6765\u6d4b\u8bd5\u670d\u52a1\u5668 IPv6 \u662f\u5426\u5df2\u7ecf\u80fd\u591f\u6b63\u5e38\u5bf9\u5916\u63d0\u4f9b\u670d\u52a1\uff1a\n<pre class=\"lang:delphi decode:true\">curl -v -6 http:\/\/aaa.bbb.com<\/pre>\n<p>\u6211\u4eec\u53ef\u4ee5\u770b curl \u7684\u8f93\u51fa\uff0c\u4ee5\u786e\u5b9a\u662f\u5426\u6b63\u5e38\u8fde\u63a5\u5230\u670d\u52a1\u5668\u4e0a\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">* Rebuilt URL to: http:\/\/aaa.bbb.com\/\r\n*   Trying xxx:xxx:xxx:xxx::xxx...\r\n* Connected to aaa.bbb.com (xxx:xxx:xxx:xxx::xxx) port 80 (#0)\r\n&gt; GET \/ HTTP\/1.1\r\n&gt; Host: ddb.b86400.com:75\r\n&gt; User-Agent: curl\/7.43.0\r\n&gt; Accept: *\/*\r\n&gt; \r\n&lt; ...<\/pre>\n<p>\u5982\u679c\u770b\u5230\u7c7b\u4f3c\u4e8e\u4e0a\u9762\u7684\u8f93\u51fa\uff0c\u5219\u8bf4\u660e IPv6 \u7684 Web \u670d\u52a1\u7aef\u5df2\u7ecf\u5de5\u4f5c\u6b63\u5e38\u3002\u5982\u679c\u4f60\u5ba2\u6237\u7aef\u7a0b\u5e8f\u4f7f\u7528\u6807\u51c6\u7684 THttpClient \u6765\u8bbf\u95ee\u670d\u52a1\u5668\u7aef\u6570\u636e\u7684\u8bdd\uff0c\u5e94\u8be5\u4e00\u5207\u5de5\u4f5c\u6b63\u5e38\u4e86\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u524d\u9762\u7684\u6587\u7ae0\u4e2d\u6211\u4eec\u4e3a\u670d\u52a1\u5668\u5206\u914d\u4e86\u4e00\u4e2a I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,602,603],"tags":[],"class_list":["post-4160","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-ios","category-603"],"views":6120,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4160"}],"version-history":[{"count":2,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4160\/revisions"}],"predecessor-version":[{"id":4163,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4160\/revisions\/4163"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}