{"id":4155,"date":"2016-08-26T16:51:53","date_gmt":"2016-08-26T08:51:53","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=4155"},"modified":"2016-08-26T16:58:52","modified_gmt":"2016-08-26T08:58:52","slug":"%e7%bd%91%e7%bb%9c-%e4%b8%ba%e9%98%bf%e9%87%8c%e4%ba%91-centos-6-x-%e6%b7%bb%e5%8a%a0-ipv6-%e6%94%af%e6%8c%81","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=4155","title":{"rendered":"[\u7f51\u7edc] \u4e3a\u963f\u91cc\u4e91 CentOS 6.x \u6dfb\u52a0 IPV6 \u652f\u6301"},"content":{"rendered":"<p>\u597d\u5427\uff0c\u963f\u91cc\u4e91\u7684\u516c\u5f00CentOS \u955c\u50cf\u5c06 IPV6 \u652f\u6301\u7ed9\u53bb\u6389\u4e86\uff0c\u5373\u4f7f\u4f60\u6309\u7167\u7f51\u7edc\u4e0a\u7684\u6559\u7a0b\uff0c\u542f\u7528 \/etc\/sysconfig\/network \u4e2d\u7684 NETWORKING_IPV6 \u4e5f\u6ca1\u5565\u7528\uff0c\u53cd\u6b63\u5b83\u5c31\u662f\u4e0d\u52a0\u8f7d IPV6 \u7684\u76f8\u5173\u6a21\u5757\u3002\u7ecf\u8fc7\u4e00\u756a\u8fd1\u4e4e\u7edd\u671b\u7684\u6298\u817e\u4e4b\u540e\uff0c\u7ec8\u4e8e\u641e\u5b9a\u4e86\u3002<\/p>\n<p>\u6211\u4eec\u9996\u5165\u8fdb\u5165 \/etc\/sysconfig\/modules\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2a\u811a\u672c\uff0c\u6211\u8fd9\u91cc\u53eb ipv6.modules\uff0c\u7136\u540e\u7f16\u8f91\u5176\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:delphi decode:true\">#!\/bin\/sh\r\nif [ ! -c \/proc\/net\/if_inet6 ] ; then\r\n  exec \/sbin\/insmod \/lib\/modules\/`uname -r`\/kernel\/net\/ipv6\/ipv6.ko\r\nfi\r\n<\/pre>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u8ba9\u64cd\u4f5c\u7cfb\u7edf\u5728\u542f\u52a8\u65f6\u81ea\u52a8\u52a0\u8f7d IPV6 \u6a21\u5757\u4e86\uff0c\u91cd\u542f\u673a\u5668\u6d4b\u8bd5\u4e0b\uff0c\u770b\u770b lsmod \u662f\u5426\u80fd\u627e\u5230 ipv6\uff0c\u627e\u5230\u5c31\u8bf4\u660e\u52a0\u8f7d\u4e0a\u4e86\u3002<\/p>\n<p>\u7136\u540e\u6211\u4eec\u8981\u4e3a\u81ea\u5df1\u7684\u670d\u52a1\u5668\u83b7\u53d6\u4e00\u4e2a IPV6 \u7684\u5730\u5740\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u00a0tunnelbroker.net \u4e0a\u7533\u8bf7\u4e00\u4e2a\u514d\u8d39\u7684 IPV6 \u5730\u5740\uff1a<\/p>\n<ol>\n<li>\u8bbf\u95ee\u00a0<a href=\"http:\/\/tunnelbroker.net\">tunnelbroker.net<\/a>\u00a0\u6ce8\u518c\u4e00\u4e2a\u81ea\u5df1\u7684\u8d26\u53f7\uff1b<\/li>\n<li>\u9009\u62e9\u00a0Create Regular Tunnel \u521b\u5efa\u4e00\u4e2a\u5230\u81ea\u5df1\u516c\u7f51 IP \u7684\u901a\u9053\u3002<\/li>\n<li>\u627e\u5230 Example Configurations \u91cc\uff0c\u627e\u5230\u81ea\u5df1\u64cd\u4f5c\u7cfb\u7edf\u5bf9\u5e94\u7684\u811a\u672c\uff0cCentOS 6.x \u9009\u62e9 Linux-route2\uff0c\u7136\u540e\u5c06\u811a\u672c\u590d\u5236\u4e0b\u6765\uff0c\u5728 linux \u7684\u63a7\u5236\u53f0\u4e2d\u6267\u884c\u811a\u672c\u3002<\/li>\n<li>ifconfig \u770b\u4e00\u4e0b IPV6 \u5730\u5740\u662f\u5426\u914d\u7f6e\u6210\u529f\uff0c\u914d\u7f6e\u6210\u529f\u7684\u8bdd\uff0c\u53ef\u4ee5\u770b\u5230\u7c7b\u4f3c\u4e0b\u9762\u7684\u5185\u5bb9\uff1a\n<pre class=\"lang:delphi decode:true\">he-ipv6   Link encap:IPv6-in-IPv4\r\n          inet6 addr: \u4f60\u7684\u5168\u5c40IPv6\u5730\u5740\/64 Scope:Global\r\n          inet6 addr: fe80::731c:4992\/128 Scope:Link\r\n          UP POINTOPOINT RUNNING NOARP  MTU:1480  Metric:1\r\n          RX packets:0 errors:0 dropped:0 overruns:0 frame:0\r\n          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0\r\n          collisions:0 txqueuelen:0\r\n          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)<\/pre>\n<\/li>\n<li>\u73b0\u5728\u4f60\u53ef\u4ee5 ping \u4e00\u4e0b\u670d\u52a1\u5668\u7684\u5730\u5740\uff0c\u770b\u770b IPv6 \u662f\u5426\u5de5\u4f5c\u6b63\u5e38\uff08Linux \u4e0bIPv6 \u7248\u7684 ping \u540d\u4e3a ping6\uff09\uff0c\u5982\u679c\u901a\u4e86\u5c31\u8bf4\u660e\u53ef\u4ee5\u4e86\uff1a\n<pre class=\"lang:delphi decode:true\">ping6 2001:470:18:ced::1\r\nPING 2001:470:18:ced::1(2001:470:18:ced::1) 56 data bytes\r\n64 bytes from 2001:470:18:ced::1: icmp_seq=1 ttl=64 time=340 ms\r\n64 bytes from 2001:470:18:ced::1: icmp_seq=2 ttl=64 time=348 ms\r\n64 bytes from 2001:470:18:ced::1: icmp_seq=3 ttl=64 time=349 ms<\/pre>\n<\/li>\n<\/ol>\n<p>\u597d\u4e86\uff0c\u73b0\u5728\u770b\u8d77\u6765\u4e00\u5207\u5de5\u4f5c\u6b63\u5e38\uff0c\u4e0d\u8fc7\u95ee\u9898\u6765\u4e86\uff0c\u5982\u679c\u6211\u4eec\u91cd\u65b0\u542f\u52a8\uff0c\u4f7f\u7528 ifconfig \u770b\u4e00\u4e0b\uff0c\u5c31\u4f1a\u53d1\u73b0 he-ipv6 \u8fd9\u4e2a\u63a5\u53e3\u6ca1\u6709\u4e86\uff0c\u6240\u4ee5\u6211\u4eec\u8fd8\u9700\u8981\u505a\u70b9\u5904\u7406\uff0c\u8ba9\u7cfb\u7edf\u6bcf\u6b21\u81ea\u52a8\u6267\u884c\u6211\u4eec\u590d\u5236\u4e0b\u6765\u7684\u811a\u672c\u3002<\/p>\n<p>\u6211\u4eec\u4fee\u6539 \/etc\/init.d\/network \u4e2d\u7684\u811a\u672c\uff0c\u5728 start) \u7684\u672b\u5c3e\u52a0\u4e0a\u6211\u4eec\u590d\u5236\u7684\u5185\u5bb9\uff0c\u5927\u6982\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:delphi decode:true\">case \"$1\" in\r\n  start)\r\n        [ \"$EUID\" != \"0\" ] &amp;&amp; exit 4\r\n        rc=0\r\n        # IPv6 hook (pre IPv4 start)\r\n        if [ -x \/etc\/sysconfig\/network-scripts\/init.ipv6-global ]; then\r\n                \/etc\/sysconfig\/network-scripts\/init.ipv6-global start pre\r\n        fi\r\n\r\n        apply_sysctl\r\n\r\n        # bring up loopback interface\r\n        action $\"Bringing up loopback interface: \" .\/ifup ifcfg-lo\r\n\r\n        case \"$VLAN\" in\r\n          yes)\r\n            if [ ! -d \/proc\/net\/vlan ] &amp;&amp; ! modprobe 8021q &gt;\/dev\/null 2&gt;&amp;1 ; then\r\n                net_log $\"No 802.1Q VLAN support available in kernel.\"\r\n            fi\r\n            ;;\r\n        esac\r\n\r\n        vlaninterfaces=\"\"\r\n        xdslinterfaces=\"\"\r\n        bridgeinterfaces=\"\"\r\n\r\n        # bring up all other interfaces configured to come up at boot time\r\n        for i in $interfaces; do\r\n                unset DEVICE TYPE SLAVE\r\n                eval $(LANG=C fgrep \"DEVICE=\" ifcfg-$i)\r\n                eval $(LANG=C fgrep \"TYPE=\" ifcfg-$i)\r\n                eval $(LANG=C fgrep \"SLAVE=\" ifcfg-$i)\r\n\r\n                if [ -z \"$DEVICE\" ] ; then DEVICE=\"$i\"; fi\r\n\r\n                if [ \"$SLAVE\" = \"yes\" ]; then\r\n                        continue\r\n                fi\r\n\r\n                if [ \"$TYPE\" = \"xDSL\" ]; then\r\n                        xdslinterfaces=\"$xdslinterfaces $i\"\r\n                        continue\r\n                fi\r\n\r\n                if [ \"$TYPE\" = \"Bridge\" ]; then\r\n                        bridgeinterfaces=\"$bridgeinterfaces $i\"\r\n                        continue\r\n                fi\r\n\r\n                if [ \"${DEVICE%%.*}\" != \"$DEVICE\"  -o  \"${DEVICE##vlan}\" != \"$DEVICE\" ] ; then\r\n                        vlaninterfaces=\"$vlaninterfaces $i\"\r\n                        continue\r\n                fi\r\n\r\n                if LANG=C egrep -L \"^ONBOOT=['\\\"]?[Nn][Oo]['\\\"]?\" ifcfg-$i &gt; \/dev\/null ; then\r\n                        # this loads the module, to preserve ordering\r\n                        is_available $i\r\n                        continue\r\n                fi\r\n                # If we're in confirmation mode, get user confirmation.\r\n                if [ -f \/var\/run\/confirm ]; then\r\n                        confirm $i\r\n                        test $? = 1 &amp;&amp; continue\r\n                fi\r\n                action $\"Bringing up interface $i: \" .\/ifup $i boot\r\n                [ $? -ne 0 ] &amp;&amp; rc=1\r\n        done\r\n\r\n        # Bring up xDSL and VPN interfaces\r\n        for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces ; do\r\n            if ! LANG=C egrep -L \"^ONBOOT=['\\\"]?[Nn][Oo]['\\\"]?\" ifcfg-$i &gt;\/dev\/null 2&gt;&amp;1 ; then\r\n                # If we're in confirmation mode, get user confirmation.\r\n                if [ -f \/var\/run\/confirm ]; then\r\n                        confirm $i\r\n                        test $? = 1 &amp;&amp; continue\r\n                fi\r\n                action $\"Bringing up interface $i: \" .\/ifup $i boot\r\n                [ $? -ne 0 ] &amp;&amp; rc=1\r\n            fi\r\n        done\r\n\r\n\r\n        # Add non interface-specific static-routes.\r\n        if [ -f \/etc\/sysconfig\/static-routes ]; then\r\n           grep \"^any\" \/etc\/sysconfig\/static-routes | while read ignore args ; do\r\n              \/sbin\/route add -$args\r\n           done\r\n        fi\r\n        # Add non interface-specific static arp entries.\r\n        if [ -f \/etc\/ethers ]; then\r\n                \/sbin\/arp -f \/etc\/ethers\r\n        fi\r\n\r\n        # IPv6 hook (post IPv4 start)\r\n        if [ -x \/etc\/sysconfig\/network-scripts\/init.ipv6-global ]; then\r\n                \/etc\/sysconfig\/network-scripts\/init.ipv6-global start post\r\n        fi\r\n        # Run this again to catch any interface-specific actions\r\n        apply_sysctl\r\n\r\n        # \u6dfb\u52a0 IPv6 \u811a\u672c\u652f\u6301       \r\n        ip tunnel add he-ipv6 mode sit remote 216.218.221.6 local \u4f60\u672c\u673a\u7684\u5916\u7f51IP ttl 255\r\n        ip link set he-ipv6 up\r\n        ip addr add \u5206\u914d\u7ed9\u4f60\u7684IPv6\u5730\u5740\/64 dev he-ipv6\r\n        ip route add ::\/0 dev he-ipv6\r\n        ip -f inet6 addr\r\n        # \u4fee\u6539\u7ed3\u675f\r\n\r\n        touch \/var\/lock\/subsys\/network\r\n\r\n        [ -n \"${NETWORKDELAY}\" ] &amp;&amp; \/bin\/sleep ${NETWORKDELAY}\r\n        ;;\r\n<\/pre>\n<p>\u597d\u4e86\uff0c\u73b0\u5728\u6bcf\u6b21\u91cd\u542f\u673a\u5668\u90fd\u53ef\u4ee5\u81ea\u52a8\u5206\u914d\u597dIP V6 \u5730\u5740\u4e86\u3002\u90a3\u4e48\u63a5\u4e0b\u6765\u7684\u95ee\u9898\u5c31\u662f\u4e3a\u4f60\u7684\u670d\u52a1\u5668\u57df\u540d\u89e3\u6790IPv6 \u5730\u5740\uff0c\u56fd\u5185\u7684\u57df\u540d\u670d\u52a1\u5546\u8bb8\u591a\u4e0d\u63d0\u4f9b AAAA \u89e3\u6790\uff0c\u4e0d\u8fc7 DNSPod \u652f\u6301\uff0c\u6240\u4ee5\u4f60\u53ef\u4ee5\u5c06\u4f60\u81ea\u5df1\u7684 DNS \u89e3\u6790\u670d\u52a1\u5668\u5207\u6362\u5230 DNSPod\uff0c\u4ece\u800c\u63d0\u4f9b IPv6 \u7684 DNS \u89e3\u6790\u652f\u6301\u3002\u8b6c\u5982\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">C:\\Users\\swish&gt;nslookup ddb.b86400.com\r\n\u670d\u52a1\u5668:  UnKnown\r\nAddress:  10.1.1.1\r\n\r\n\u975e\u6743\u5a01\u5e94\u7b54:\r\n\u540d\u79f0:    ddb.b86400.com\r\nAddresses:  2001:470:18:cec::2\r\n          218.60.14.203<\/pre>\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u5b83\u5c31\u6709\u4e86\u4e00\u4e2a IPv6 \u7684\u5730\u5740\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u597d\u5427\uff0c\u963f\u91cc\u4e91\u7684\u516c\u5f00CentOS \u955c\u50cf\u5c06  [&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":[8,21],"tags":[667,668,666,669],"class_list":["post-4155","post","type-post","status-publish","format-standard","hentry","category-delphi","category-misc","tag-6-5","tag-6-8","tag-centos","tag-669"],"views":4816,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4155","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=4155"}],"version-history":[{"count":3,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4155\/revisions"}],"predecessor-version":[{"id":4158,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4155\/revisions\/4158"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}