{"id":170845,"date":"2011-08-07T12:30:20","date_gmt":"2011-08-07T19:30:20","guid":{"rendered":"http:\/\/chinadigitaltimes.net\/chinese\/2011\/08\/ipv4openvpn%e5%ae%9e%e7%8e%b0ipv6%e8%ae%bf%e9%97%ae\/"},"modified":"2011-08-07T12:30:20","modified_gmt":"2011-08-07T19:30:20","slug":"ipv4openvpn%e5%ae%9e%e7%8e%b0ipv6%e8%ae%bf%e9%97%ae","status":"publish","type":"post","link":"https:\/\/chinadigitaltimes.net\/chinese\/170845.html","title":{"rendered":"IPv4+OpenVPN\u5b9e\u73b0IPv6\u8bbf\u95ee"},"content":{"rendered":"<p><p><span>\u6765\u6e90\uff1a<a href=\"http:\/\/lolis.info\/2011-08\/thread-1271-1-1.html\" target=\"_blank\" rel=\"noopener\">http:\/\/lolis.info\/2011-08\/thread-1271-1-1.html<\/a>     <\/p>\n<p>IPv4\u8d44\u6e90\u5df2\u7ecf\u4ece\u597d\u4e45\u524d\u5c31\u5df2\u7ecf\u67af\u7aed\uff0c\u5929\u671d\u7535\u4fe1\u7b49ISP\u4e1d\u6beb\u6ca1\u6709\u52a0\u5165IPv6\u652f\u6301\u7684\u6253\u7b97\uff0c\u600e\u6837\u624d\u80fd\u5728IPv4\u73af\u5883\u4e0b\u8bbf\u95eeIPv6\u8d44\u6e90\u5462\uff1f\u672c\u6587\u5c06\u7740\u91cd\u4ecb\u7ecd\u3002<\/p>\n<p><span><\/span><\/p>\n<p>\u8bf4\u4e0b\u914d\u7f6e\u73af\u5883\uff1aCentos+OVPN\u670d\u52a1\u7aef\uff0cWin7\u4f5c\u4e3a\u5ba2\u6237\u7aef<\/p>\n<p>\u53c2\u8003\u914d\u7f6e\u7684\u6587\u7ae0\u6709<a href=\"https:\/\/humou.net\/blog\/201102041307.html\" target=\"_blank\" rel=\"noopener\">\u8fd9\u7bc7<\/a>\uff0c<a href=\"http:\/\/www.linode.com\/wiki\/index.php\/IPv6#Debian\" target=\"_blank\" rel=\"noopener\">\u8fd9\u7bc7<\/a>\uff0c<a href=\"http:\/\/www.linux-ipv6.org\/ml\/usagi-users\/msg00847.html\" target=\"_blank\" rel=\"noopener\">\u8fd9\u7bc7<\/a>\uff0c<a href=\"http:\/\/forum.soluslabs.com\/showthread.php\/2083-Setting-up-Ipv6-in-Ovh\" target=\"_blank\" rel=\"noopener\">\u8fd9\u7bc7<\/a>\u548c<a href=\"http:\/\/lolis.info\/2010-04\/thread-635-1-1.html\" target=\"_blank\" rel=\"noopener\">\u8fd9\u7bc7<\/a>\u3002<\/p>\n<p>\u5176\u4ed6\u8981\u6c42\uff1a\u670d\u52a1\u5668\u8981\u652f\u6301IPv6\uff0c\u8981\u6709\u5927\u91cf\u7684\u65f6\u95f4\u8c03\u8bd5\u3002<\/p>\n<p>\u5b9e\u73b0\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<p><a href=\"http:\/\/lolis.info\/wp-content\/uploads\/2011\/08\/image.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"196\" src=\"http:\/\/lolis.info\/wp-content\/uploads\/2011\/08\/image_thumb.png\" title=\"image\" width=\"522\" \/><\/a><\/p>\n<p>\u00a0<\/p>\n<p>\u9996\u5148\uff0c\u5148\u5728VPS\u9762\u677f\u542f\u7528IPv6\u652f\u6301\uff0c\u8bb0\u5f55\u4e0b\u672c\u673a\u7684IP<\/p>\n<p><a href=\"http:\/\/lolis.info\/wp-content\/uploads\/2011\/08\/image1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"138\" src=\"http:\/\/lolis.info\/wp-content\/uploads\/2011\/08\/image_thumb1.png\" title=\"image\" width=\"523\" \/><\/a><\/p>\n<p>\u7136\u540e\u5230<a href=\"http:\/\/tunnelbroker.net\/\" target=\"_blank\" rel=\"noopener\">HE<\/a>\u521b\u5efa\u4e00\u4e2atunnel\uff0c\u521b\u5efa\u8fc7\u7a0b\u4e0d\u8868\uff0c\u754c\u9762\u7559\u7740\u522b\u5173\u3002<\/p>\n<p><a href=\"http:\/\/lolis.info\/wp-content\/uploads\/2011\/08\/image2.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" alt=\"image\" border=\"0\" height=\"429\" src=\"http:\/\/lolis.info\/wp-content\/uploads\/2011\/08\/image_thumb2.png\" title=\"image\" width=\"614\" \/><\/a><\/p>\n<p>\u4e0a\u56fe\u4e3a\u5f88\u91cd\u8981\u7684\u914d\u7f6e\u9875\u9762\uff0c\u5207\u8bb0\u7559\u4f4f<\/p>\n<p>\u4e0b\u9762\u56de\u5230shell<\/p>\n<blockquote>\n<p>vi \/etc\/sysconfig\/network<\/p>\n<\/blockquote>\n<p>\u52a0\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<blockquote>\n<p>NETWORKING_IPV6=yes<\/p>\n<p>IPV6_DEFAULTDEV=sit1<\/p>\n<\/blockquote>\n<p>\u4fdd\u5b58\uff0c\u521b\u5efa\/etc\/sysconfig\/network-scripts\/ifcfg-sit1<\/p>\n<p>\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<blockquote>\n<p>DEVICE=sit1<span>\u00a0<\/span>        <br \/>BOOTPROTO=none<span>\u00a0<\/span>        <br \/>ONBOOT=yes<span>\u00a0<\/span>        <br \/>IPV6INIT=yes<span>\u00a0<\/span>        <br \/>IPV6TUNNELIPV4=HESupplied-ServerIPv4address<span>\u00a0<\/span>          <br \/>IPV6ADDR=HESupplied-ClientIPv6address<\/p>\n<\/blockquote>\n<p>\u7b2c\u4e00\u6bb5\u9ad8\u4eae\u662fHE\u7684\u670d\u52a1\u5668IPv4\u5730\u5740\uff0c\u7b2c\u4e8c\u6bb5\u662f\u5ba2\u6237\u7aefIPv6\u5730\u5740\uff0c\u5206\u522b\u586b\u5199\uff0c\u6ce8\u610f\u522b\u628a\/64\u4e5f\u5199\u8fdb\u53bb\u4e86<\/p>\n<p>\u89e3\u91ca\u4e00\u4e0b\uff0c\u4e0a\u9762\u662f\u6dfb\u52a0\u4e00\u4e2asit1\u7684\u63a5\u53e3\u548cHE\u7684tunnel\u901a\u4fe1\u3002<\/p>\n<p>\u542f\u7528\u8fd9\u4e2a\u63a5\u53e3\u6267\u884c\uff1a<\/p>\n<blockquote>\n<p>ifup sit1<\/p>\n<\/blockquote>\n<p>\u65e0\u56de\u663e\u5219\u6b63\u5e38\u3002<\/p>\n<p>\u91cd\u542f\u7f51\u7edc\u670d\u52a1\uff1a<\/p>\n<blockquote>\n<p>\/etc\/init.d\/network restart<\/p>\n<\/blockquote>\n<p>\u8981\u786e\u4fdd\u65e0\u9519\u8bef\u624d\u6b63\u5e38<\/p>\n<p>\u7136\u540e\u542f\u7528IPv6\u8f6c\u53d1\u652f\u6301\uff1a<\/p>\n<p>\u5728 \/etc\/sysconfig\/network\u4e2d\uff0c\u52a0\u5165\uff1a<\/p>\n<blockquote>\n<p>IPV6FORWARDING=yes<\/p>\n<\/blockquote>\n<p>\u5728\/etc\/sysconfig\/network-scripts\/ifcfg-eth0\u4e2d\uff0c\u52a0\u5165\uff1a<\/p>\n<blockquote>\n<p>IPV6_ROUTER=yes<\/p>\n<\/blockquote>\n<p>\u7f16\u8f91\u8f6c\u53d1\u9009\u9879\uff08\u5343\u4e07\u522b\u548cIPv4\u7684\u8f6c\u53d1\u6df7\u4e86\uff0c\u7136\u540e\u5fd8\u4e86\u6dfb\u52a0\uff09\uff1a<\/p>\n<blockquote>\n<p>vi \/etc\/sysctl.conf<\/p>\n<\/blockquote>\n<p>\u52a0\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<blockquote>\n<p>net.ipv6.conf.all.forwarding = 1<span>\u00a0<\/span>        <br \/>net.ipv6.conf.default.forwarding=1<\/p>\n<\/blockquote>\n<p>\u6267\u884c\uff1a<\/p>\n<blockquote>\n<p>sysctl -p<\/p>\n<p>\/etc\/init.d\/network restart<\/p>\n<\/blockquote>\n<p>\u5f53\u91cd\u542f\u7f51\u7edc\u670d\u52a1\u65f6\uff0c\u8fd9\u65f6\u5019\u4e0d\u5e94\u8be5\u518d\u770b\u89c1\u6709\u5982\u4e0b\u9519\u8bef\uff1a<\/p>\n<blockquote>\n<p>Bringing up interface eth0:\u00a0 Global IPv6 forwarding is disabled in configuration, but not currently disabled in kernel<span>\u00a0<\/span>        <br \/>Please restart network with \u2018\/sbin\/service network restart\u2019<\/p>\n<\/blockquote>\n<p>\u7136\u540e\u6784\u5efaOVPN\uff0c\u5177\u4f53\u4e0d\u5728\u8fd9\u7bc7\u6587\u7ae0\u8ba8\u8bba\u8303\u56f4\u5185\u3002\u5728\u670d\u52a1\u5668\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u52a0\u5165\u5982\u4e0b\u51e0\u884c\uff1a<\/p>\n<blockquote>\n<p>script-security 2<span>\u00a0<\/span>        <br \/>client-connect \/etc\/openvpn\/client-connect.sh<span>\u00a0<\/span>        <br \/>client-disconnect \/etc\/openvpn\/client-disconnect.sh<\/p>\n<\/blockquote>\n<p>\u4fdd\u5b58\uff0c\u7f16\u8f91\/etc\/openvpn\/client-connect.sh<span>\u00a0<\/span>      <br \/>\u8f93\u5165\uff1a<\/p>\n<blockquote>\n<p>#!\/bin\/bash<\/p>\n<p># This is a script that is run each time a remote client connects<span>\u00a0<\/span>        <br \/># to this openvpn server.<span>\u00a0<\/span>        <br \/># it will setup the ipv6 tunnel depending on the ip address that was<span>\u00a0<\/span>        <br \/># given to the client<\/p>\n<p>BASERANGE=&#8221;2001:470:baa2&#8243;<span>\u00a0<\/span>##\u4f60\u768448\u4f4d\u7684ipv6\u5730\u5740\u5757\u524d\u7f00\uff0c\u89c1\u56fe<span>\u00a0<\/span>          <br \/># v6net is the last section of the ipv4 address that openvpn allocated<span>\u00a0<\/span>        <br \/>V6NET=$(echo $ifconfig_pool_remote_ip | awk -F. \u2018print $NF\u2019)<\/p>\n<p>SITID=&#8221;sit$V6NET&#8221;<\/p>\n<p># setup the sit between the local and remote openvpn addresses<span>\u00a0<\/span>        <br \/>\/sbin\/ip tunnel add $SITID mode sit ttl 64 remote $ifconfig_pool_remote_ip local $ifconfig_local<span>\u00a0<\/span>        <br \/>\/sbin\/ip link set dev $SITID up<\/p>\n<p># config routing for the new network<span>\u00a0<\/span>        <br \/>\/sbin\/ip -6 addr add $BASERANGE:$V6NET::1\/64 dev $SITID<span>\u00a0<\/span>        <br \/>\/sbin\/ip -6 route add $BASERANGE:$V6NET::\/64 via $BASERANGE:$V6NET::2 dev $SITID metric 1<\/p>\n<p># log to syslog<span>\u00a0<\/span>        <br \/>echo &#8220;$script_type client_ip:$trusted_ip common_name:$common_name local_ip:$ifconfig_local <span>\u00a0<\/span>        <br \/>remote_ip:$ifconfig_pool_remote_ip sit:$SITID ipv6net:$V6NET&#8221; | \/usr\/bin\/logger -t ovpn<\/p>\n<\/blockquote>\n<p>\u5207\u8bb0\u4fee\u6539\u3002<\/p>\n<p>\u7f16\u8f91\/etc\/openvpn\/client-disconnect.sh<span>\u00a0<\/span>      <br \/>\u8f93\u5165\uff1a<\/p>\n<blockquote>\n<p>#!\/bin\/bash<\/p>\n<p># This is a script that is run each time a remote client disconnects<span>\u00a0<\/span>        <br \/># to this openvpn server.<\/p>\n<p>BASERANGE=&#8221;2001:470:baa2&#8243;<span>\u00a0<\/span>        <br \/># v6net is the last section of the ipv4 address that openvpn allocated<span>\u00a0<\/span>        <br \/>V6NET=$(echo $ifconfig_pool_remote_ip | awk -F. \u2018print $NF\u2019)<\/p>\n<p>SITID=&#8221;sit$V6NET&#8221;<\/p>\n<p>\/sbin\/ip -6 addr del $BASERANGE:$V6NET::1\/64 dev $SITID<\/p>\n<p># remove the sit between the local and:q<\/p>\n<p>#remote openvpn addresses<\/p>\n<p>\/sbin\/ip link set dev $SITID down<span>\u00a0<\/span>        <br \/>\/sbin\/ip tunnel del $SITID mode sit ttl 64 remote $ifconfig_pool_remote_ip local $ifconfig_local<\/p>\n<p># log to syslog<span>\u00a0<\/span>        <br \/>echo &#8220;$script_type client_ip:$trusted_ip common_name:$common_name local_ip:$ifconfig_local <span>\u00a0<\/span>        <br \/>remote_ip:$ifconfig_pool_remote_ip sit:$SITID ipv6net:$V6NET duration:$time_duration <span>\u00a0<\/span>        <br \/>received:$bytes_received sent:$bytes_sent&#8221; | \/usr\/bin\/logger -t ovpn<\/p>\n<\/blockquote>\n<p>\u9ec4\u5b57\u90e8\u5206\u5207\u8bb0\u4fee\u6539\uff0c\u89c1HE\u914d\u7f6e\u4fee\u6539\u3002<\/p>\n<p>\u7136\u540e\u914d\u7f6e\u6743\u9650\uff1a<\/p>\n<blockquote>\n<p>cd \/etc\/openvpn\/<\/p>\n<p>chmod 777 .\/*<\/p>\n<\/blockquote>\n<p>\u7528killall openvpn\u6740\u6b7bOVPN\u8fdb\u7a0b\u540e\uff0c\u91cd\u8f7d\u914d\u7f6e\u6587\u4ef6\uff0c\u8fde\u63a5\u4e00\u904dVPN\uff0c\u770b\u662f\u5426\u8fde\u5f97\u4e0a\u3002<\/p>\n<p>\u8fde\u4e0aOVPN\u540e\uff0c\u5728shell\u6267\u884cifconfig -a<span>\u00a0<\/span>\u5e94\u8be5\u80fd\u770b\u89c1\u9664\u4e86sit1\u5916\u7684sit\u63a5\u53e3\uff0c\u4f8b\u5982sit6\u7b49\u7b49\u3002<\/p>\n<p>\u56de\u5230\u5ba2\u6237\u673a\uff0c\u6253\u5f00cmd\uff0c\u9010\u6761\u8f93\u5165\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n<blockquote>\n<p>netsh interface ipv6 add v6v4tunnel interface=IP6Tunnel<span>\u00a0<\/span>10.168.1.6 10.168.1.1<span>\u00a0<\/span>          <br \/>netsh interface ipv6 add address IP6Tunnel<span>\u00a0<\/span>2001:470:baa2:6::2\/64<span>\u00a0<\/span>        <br \/>netsh interface ipv6 add route ::\/0 IP6Tunnel<span>\u00a0<\/span>2001:470:baa2:6::1<\/p>\n<\/blockquote>\n<p>\u9ec4\u5b57\u90e8\u5206\u662f\u9700\u8981\u4fee\u6539\u7684\uff0c\u7f51\u6bb5\u662fOVPN\u5206\u914d\u7684\u7f51\u6bb5\uff0c2001:470:baa2:6::1\u662f\u7531ifconfig -a\u547d\u4ee4\u67e5\u5f97sit\u63a5\u53e3\u7684IPv6\u5730\u5740\u5f97\u5230\u7684\uff0c\u4e24\u4e2a\u5730\u5740\u4fdd\u6301\u524d\u7f00\u4e00\u81f4\uff0c\u540e\u9762\u7684::2\u548c::1\u4e0d\u9700\u8981\u4e00\u81f4\u3002<\/p>\n<p>\u8fde\u4e0aOVPN\uff0c\u6b63\u5e38\u6765\u8bf4\uff0cping\u4e00\u4e0b<a href=\"http:\/\/ipv6.google.com\/\" target=\"_blank\" rel=\"noopener\">ipv6.google.com<\/a><span>\u00a0<\/span>\u5c31\u4f1a\u901a\u4e86\uff0c\u5982\u679c\u4e0d\u901a\uff0c\u4f46\u662f\u80fd\u89e3\u6790\u51faIPv6\u7684IP\uff0c\u5219\u8bf4\u660e\u662f\u4e0a\u8ff0CMD\u547d\u4ee4\u6709\u95ee\u9898\uff0c\u5e94\u8be5\u5220\u9664\u540e\u91cd\u65b0\u5efa\u7acb\uff0c\u5426\u5219\u4f1a\u56e0\u4e3a\u4e0d\u4f1a\u5230\u8fbe\u4e0b\u4e00\u8df3\uff0c\u51fa\u73b0ping\u4e0d\u901a\uff0c\u53ef \u4ee5\u89e3\u6790\u7684\u95ee\u9898\u3002\u4f46\u662f\u540c\u65f6\u8981\u533a\u522b\u4e8eIPv6 forward\u914d\u7f6e\u6709\u8bef\uff0cIPv6 forward\u914d\u7f6e\u9519\u8bef\u4f46\u662f\u672c\u5730\u5ba2\u6237\u7aef\u65e0\u8bef\uff0c\u5219\u5e94\u8be5\u51fa\u73b0\u53ef\u4ee5ping\u901a\u670d\u52a1\u5668\u672c\u673a\u7684IPv6\u5730\u5740\uff0cping\u4e0d\u901a\u5176\u4ed6\u5730\u5740\u7684\u95ee\u9898\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u914d\u7f6e\u8fc7\u7a0b\u4e2d\u8fd8\u51fa\u73b0\u8fc7\u201cOpenVPN: script failed: could not execute external program\u201d\u4e4b\u7c7b\u7684\u95ee\u9898\uff0c\u5747\u662f\u7531\u4e8e\u6559\u7a0b\u4e0d\u5168\u9762\u5bfc\u81f4\u7684\u5947\u5947\u602a\u602a\u7684\u95ee\u9898\uff0c\u5747\u5df2\u7ecf\u5728\u672c\u6587\u4fee\u6b63\uff0c\u5982\u679c\u5728\u914d\u7f6e\u8fc7\u7a0b\u4e2d\u53d1\u73b0\u6709\u5176\u4ed6\u95ee\u9898\uff0c\u5e94\u8be5\u7406\u6e05\u601d\u8def\uff0c\u9010\u70b9\u6392\u67e5\uff0c\u5c06 \u9519\u8bef\u5b9a\u4f4d\u5728\u6700\u5c0f\u7684\u8303\u56f4\u5185\uff0c\u624d\u6709\u5e0c\u671b\u80fd\u89e3\u51b3\u3002<\/p>\n<\/p>\n<p><\/span><\/p>\n<p>  <a href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/xijie.wordpress.com\/4846\/\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/xijie.wordpress.com\/4846\/\" \/><\/a> <a href=\"http:\/\/feeds.wordpress.com\/1.0\/godelicious\/xijie.wordpress.com\/4846\/\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/delicious\/xijie.wordpress.com\/4846\/\" \/><\/a> <a href=\"http:\/\/feeds.wordpress.com\/1.0\/gofacebook\/xijie.wordpress.com\/4846\/\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/facebook\/xijie.wordpress.com\/4846\/\" \/><\/a> <a href=\"http:\/\/feeds.wordpress.com\/1.0\/gotwitter\/xijie.wordpress.com\/4846\/\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/twitter\/xijie.wordpress.com\/4846\/\" \/><\/a> <a href=\"http:\/\/feeds.wordpress.com\/1.0\/gostumble\/xijie.wordpress.com\/4846\/\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/stumble\/xijie.wordpress.com\/4846\/\" \/><\/a> <a href=\"http:\/\/feeds.wordpress.com\/1.0\/godigg\/xijie.wordpress.com\/4846\/\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/digg\/xijie.wordpress.com\/4846\/\" \/><\/a> <a href=\"http:\/\/feeds.wordpress.com\/1.0\/goreddit\/xijie.wordpress.com\/4846\/\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/reddit\/xijie.wordpress.com\/4846\/\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" height=\"1\" src=\"http:\/\/stats.wordpress.com\/b.gif?host=xijie.wordpress.com&#038;blog=10068099&#038;post=4846&#038;subd=xijie&#038;ref=&#038;feed=1\" width=\"1\" \/><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/chinadigitaltimes.net\/chinese\/files\/2011\/08\/a39abb99image_thumb.png-150x150.png\" \/><\/p>\n<p><small>\u672c\u6587\u7531\u81ea\u52a8\u805a\u5408\u7a0b\u5e8f\u53d6\u81ea\u7f51\u7edc\uff0c\u5185\u5bb9\u548c\u89c2\u70b9\u4e0d\u4ee3\u8868\u6570\u5b57\u65f6\u4ee3\u7acb\u573a<\/small><\/p>\n<form method=\"POST\" action=\"http:\/\/www.feedblitz.com\/f\/f.fbz?AddNewUserDirect\">\n\u5b9a\u671f\u83b7\u5f97\u7ffb\u5899\u4fe1\u606f\uff1f<a href=\"http:\/\/www.feedblitz.com\/f\/?Sub=738338\" target=\"_blank\" rel=\"noopener\">\u8bf7\u7535\u90ae\u8ba2\u9605\u6570\u5b57\u65f6\u4ee3<\/a> <br \/><input name=\"EMAIL\" maxlength=\"64\" type=\"text\" size=\"25\" value=\"\"><br \/>\n<input name=\"FEEDID\" type=\"hidden\" value=\"738338\"><br \/>\n<input name=\"PUBLISHER\" type=\"hidden\" value=\"7485568\"><br \/>\n<input type=\"submit\" value=\"\u8ba2\u9605!\"><br \/>\n<\/form>\n","protected":false},"excerpt":{"rendered":"<p> \u6765\u6e90\uff1a http:\/\/lolis.info\/2011-08\/thread-1271-1-1.html IPv4\u8d44\u6e90\u5df2\u7ecf\u4ece\u597d\u4e45\u524d\u5c31\u5df2\u7ecf\u67af\u7aed\uff0c\u5929\u671d\u7535\u4fe1\u7b49ISP\u4e1d\u6beb\u6ca1\u6709\u52a0\u5165IPv6\u652f\u6301\u7684\u6253\u7b97\uff0c\u600e\u6837\u624d\u80fd\u5728IPv4\u73af\u5883\u4e0b\u8bbf\u95eeIPv6\u8d44\u6e90\u5462\uff1f\u672c\u6587\u5c06\u7740\u91cd\u4ecb\u7ecd\u3002 \u8bf4\u4e0b\u914d\u7f6e\u73af\u5883\uff1aCentos+OVPN\u670d\u52a1\u7aef\uff0cWin7\u4f5c\u4e3a\u5ba2\u6237\u7aef \u53c2\u8003\u914d\u7f6e\u7684\u6587\u7ae0\u6709 \u8fd9\u7bc7 \uff0c \u8fd9\u7bc7 \uff0c \u8fd9\u7bc7 \uff0c \u8fd9\u7bc7 \u548c \u8fd9\u7bc7 \u3002 \u5176\u4ed6\u8981\u6c42\uff1a\u670d\u52a1\u5668\u8981\u652f\u6301IPv6\uff0c\u8981\u6709\u5927\u91cf\u7684\u65f6\u95f4\u8c03\u8bd5\u3002 \u5b9e\u73b0\u6548\u679c\u5982\u4e0b\uff1a \u00a0 \u9996\u5148\uff0c\u5148\u5728VPS\u9762\u677f\u542f\u7528IPv6\u652f\u6301\uff0c\u8bb0\u5f55\u4e0b\u672c\u673a\u7684IP \u7136\u540e\u5230 HE \u521b\u5efa\u4e00\u4e2atunnel\uff0c\u521b\u5efa\u8fc7\u7a0b\u4e0d\u8868\uff0c\u754c\u9762\u7559\u7740\u522b\u5173\u3002 \u4e0a\u56fe\u4e3a\u5f88\u91cd\u8981\u7684\u914d\u7f6e\u9875\u9762\uff0c\u5207\u8bb0\u7559\u4f4f \u4e0b\u9762\u56de\u5230shell vi \/etc\/sysconfig\/network \u52a0\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a NETWORKING_IPV6=yes IPV6_DEFAULTDEV=sit1 \u4fdd\u5b58\uff0c\u521b\u5efa\/etc\/sysconfig\/network-scripts\/ifcfg-sit1 \u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a DEVICE=sit1 \u00a0 BOOTPROTO=none \u00a0 ONBOOT=yes \u00a0 IPV6INIT=yes \u00a0 IPV6TUNNELIPV4=HESupplied-ServerIPv4address \u00a0 IPV6ADDR=HESupplied-ClientIPv6address \u7b2c\u4e00\u6bb5\u9ad8\u4eae\u662fHE\u7684\u670d\u52a1\u5668IPv4\u5730\u5740\uff0c\u7b2c\u4e8c\u6bb5\u662f\u5ba2\u6237\u7aefIPv6\u5730\u5740\uff0c\u5206\u522b\u586b\u5199\uff0c\u6ce8\u610f\u522b\u628a\/64\u4e5f\u5199\u8fdb\u53bb\u4e86 \u89e3\u91ca\u4e00\u4e0b\uff0c\u4e0a\u9762\u662f\u6dfb\u52a0\u4e00\u4e2asit1\u7684\u63a5\u53e3\u548cHE\u7684tunnel\u901a\u4fe1\u3002 \u542f\u7528\u8fd9\u4e2a\u63a5\u53e3\u6267\u884c\uff1a ifup sit1 \u65e0\u56de\u663e\u5219\u6b63\u5e38\u3002 \u91cd\u542f\u7f51\u7edc\u670d\u52a1\uff1a \/etc\/init.d\/network restart \u8981\u786e\u4fdd\u65e0\u9519\u8bef\u624d\u6b63\u5e38 \u7136\u540e\u542f\u7528IPv6\u8f6c\u53d1\u652f\u6301\uff1a \u5728 \/etc\/sysconfig\/network\u4e2d\uff0c\u52a0\u5165\uff1a IPV6FORWARDING=yes \u5728\/etc\/sysconfig\/network-scripts\/ifcfg-eth0\u4e2d\uff0c\u52a0\u5165\uff1a IPV6_ROUTER=yes \u7f16\u8f91\u8f6c\u53d1\u9009\u9879\uff08\u5343\u4e07\u522b\u548cIPv4\u7684\u8f6c\u53d1\u6df7\u4e86\uff0c\u7136\u540e\u5fd8\u4e86\u6dfb\u52a0\uff09\uff1a vi \/etc\/sysctl.conf \u52a0\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a net.ipv6.conf.all.forwarding = 1 \u00a0 net.ipv6.conf.default.forwarding=1 \u6267\u884c\uff1a sysctl -p \/etc\/init.d\/network restart \u5f53\u91cd\u542f\u7f51\u7edc\u670d\u52a1\u65f6\uff0c\u8fd9\u65f6\u5019\u4e0d\u5e94\u8be5\u518d\u770b\u89c1\u6709\u5982\u4e0b\u9519\u8bef\uff1a Bringing up interface eth0:\u00a0 Global IPv6 forwarding is disabled in configuration, but not currently disabled in kernel \u00a0 Please restart network with \u2018\/sbin\/service network restart\u2019 \u7136\u540e\u6784\u5efaOVPN\uff0c\u5177\u4f53\u4e0d\u5728\u8fd9\u7bc7\u6587\u7ae0\u8ba8\u8bba\u8303\u56f4\u5185\u3002\u5728\u670d\u52a1\u5668\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u52a0\u5165\u5982\u4e0b\u51e0\u884c\uff1a script-security 2 \u00a0 client-connect \/etc\/openvpn\/client-connect.sh \u00a0 client-disconnect \/etc\/openvpn\/client-disconnect.sh \u4fdd\u5b58\uff0c\u7f16\u8f91\/etc\/openvpn\/client-connect.sh \u00a0 \u8f93\u5165\uff1a #!\/bin\/bash # This is a script that is run each time a remote client connects \u00a0 # to this openvpn server. \u00a0 # it will setup the ipv6 tunnel depending on the ip address that was \u00a0 # given to the client BASERANGE=&#8221;2001:470:baa2&#8243; \u00a0 ##\u4f60\u768448\u4f4d\u7684ipv6\u5730\u5740\u5757\u524d\u7f00\uff0c\u89c1\u56fe \u00a0 # v6net is the last section of the ipv4 address that openvpn allocated \u00a0 V6NET=$(echo ${ifconfig_pool_remote_ip} | awk -F. \u2018{print $NF}\u2019) SITID=&#8221;sit${V6NET}&#8221; # setup the sit between the local and remote openvpn addresses \u00a0 \/sbin\/ip tunnel add ${SITID} mode sit ttl 64 remote ${ifconfig_pool_remote_ip} local ${ifconfig_local} \u00a0 \/sbin\/ip link set dev ${SITID} up # config routing for the new network \u00a0 \/sbin\/ip -6 addr add ${BASERANGE}:${V6NET}::1\/64 dev ${SITID} \u00a0 \/sbin\/ip -6 route add ${BASERANGE}:${V6NET}::\/64 via ${BASERANGE}:${V6NET}::2 dev ${SITID} metric 1 # log to syslog \u00a0 echo &#8220;${script_type} client_ip:${trusted_ip} common_name:${common_name} local_ip:${ifconfig_local}  \u00a0 remote_ip:${ifconfig_pool_remote_ip} sit:${SITID} ipv6net:${V6NET}&#8221; | \/usr\/bin\/logger -t ovpn \u5207\u8bb0\u4fee\u6539\u3002 \u7f16\u8f91\/etc\/openvpn\/client-disconnect.sh \u00a0 \u8f93\u5165\uff1a #!\/bin\/bash # This is a script that is run each time a remote client disconnects \u00a0 # to this openvpn server. BASERANGE=&#8221;2001:470:baa2&#8243; \u00a0 # v6net is the last section of the ipv4 address that openvpn allocated \u00a0 V6NET=$(echo ${ifconfig_pool_remote_ip} | awk -F. \u2018{print $NF}\u2019) SITID=&#8221;sit${V6NET}&#8221; \/sbin\/ip -6 addr del ${BASERANGE}:${V6NET}::1\/64 dev ${SITID} # remove the sit between the local and:q #remote openvpn addresses \/sbin\/ip link set dev ${SITID} down \u00a0 \/sbin\/ip tunnel del ${SITID} mode sit ttl 64 remote ${ifconfig_pool_remote_ip} local ${ifconfig_local} # log to syslog \u00a0 echo &#8220;${script_type} client_ip:${trusted_ip} common_name:${common_name} local_ip:${ifconfig_local}  \u00a0 remote_ip:${ifconfig_pool_remote_ip} sit:${SITID} ipv6net:${V6NET} duration:${time_duration}  \u00a0 received:${bytes_received} sent:${bytes_sent}&#8221; | \/usr\/bin\/logger -t ovpn \u9ec4\u5b57\u90e8\u5206\u5207\u8bb0\u4fee\u6539\uff0c\u89c1HE\u914d\u7f6e\u4fee\u6539\u3002 \u7136\u540e\u914d\u7f6e\u6743\u9650\uff1a cd \/etc\/openvpn\/ chmod 777 .\/* \u7528killall openvpn\u6740\u6b7bOVPN\u8fdb\u7a0b\u540e\uff0c\u91cd\u8f7d\u914d\u7f6e\u6587\u4ef6\uff0c\u8fde\u63a5\u4e00\u904dVPN\uff0c\u770b\u662f\u5426\u8fde\u5f97\u4e0a\u3002 \u8fde\u4e0aOVPN\u540e\uff0c\u5728shell\u6267\u884cifconfig -a \u00a0 \u5e94\u8be5\u80fd\u770b\u89c1\u9664\u4e86sit1\u5916\u7684sit\u63a5\u53e3\uff0c\u4f8b\u5982sit6\u7b49\u7b49\u3002 \u56de\u5230\u5ba2\u6237\u673a\uff0c\u6253\u5f00cmd\uff0c\u9010\u6761\u8f93\u5165\u4ee5\u4e0b\u6307\u4ee4\uff1a netsh interface ipv6 add v6v4tunnel interface=IP6Tunnel \u00a0 10.168.1.6 10.168.1.1 \u00a0 netsh interface ipv6 add address IP6Tunnel \u00a0 2001:470:baa2:6::2\/64 \u00a0 netsh interface ipv6 add route ::\/0 IP6Tunnel \u00a0 2001:470:baa2:6::1 \u9ec4\u5b57\u90e8\u5206\u662f\u9700\u8981\u4fee\u6539\u7684\uff0c\u7f51\u6bb5\u662fOVPN\u5206\u914d\u7684\u7f51\u6bb5\uff0c2001:470:baa2:6::1\u662f\u7531ifconfig -a\u547d\u4ee4\u67e5\u5f97sit\u63a5\u53e3\u7684IPv6\u5730\u5740\u5f97\u5230\u7684\uff0c\u4e24\u4e2a\u5730\u5740\u4fdd\u6301\u524d\u7f00\u4e00\u81f4\uff0c\u540e\u9762\u7684::2\u548c::1\u4e0d\u9700\u8981\u4e00\u81f4\u3002 \u8fde\u4e0aOVPN\uff0c\u6b63\u5e38\u6765\u8bf4\uff0cping\u4e00\u4e0b ipv6.google.com \u00a0 \u5c31\u4f1a\u901a\u4e86\uff0c\u5982\u679c\u4e0d\u901a\uff0c\u4f46\u662f\u80fd\u89e3\u6790\u51faIPv6\u7684IP\uff0c\u5219\u8bf4\u660e\u662f\u4e0a\u8ff0CMD\u547d\u4ee4\u6709\u95ee\u9898\uff0c\u5e94\u8be5\u5220\u9664\u540e\u91cd\u65b0\u5efa\u7acb\uff0c\u5426\u5219\u4f1a\u56e0\u4e3a\u4e0d\u4f1a\u5230\u8fbe\u4e0b\u4e00\u8df3\uff0c\u51fa\u73b0ping\u4e0d\u901a\uff0c\u53ef \u4ee5\u89e3\u6790\u7684\u95ee\u9898\u3002\u4f46\u662f\u540c\u65f6\u8981\u533a\u522b\u4e8eIPv6 forward\u914d\u7f6e\u6709\u8bef\uff0cIPv6 forward\u914d\u7f6e\u9519\u8bef\u4f46\u662f\u672c\u5730\u5ba2\u6237\u7aef\u65e0\u8bef\uff0c\u5219\u5e94\u8be5\u51fa\u73b0\u53ef\u4ee5ping\u901a\u670d\u52a1\u5668\u672c\u673a\u7684IPv6\u5730\u5740\uff0cping\u4e0d\u901a\u5176\u4ed6\u5730\u5740\u7684\u95ee\u9898\u3002 \u00a0 \u914d\u7f6e\u8fc7\u7a0b\u4e2d\u8fd8\u51fa\u73b0\u8fc7\u201cOpenVPN: script failed: could not execute external program\u201d\u4e4b\u7c7b\u7684\u95ee\u9898\uff0c\u5747\u662f\u7531\u4e8e\u6559\u7a0b\u4e0d\u5168\u9762\u5bfc\u81f4\u7684\u5947\u5947\u602a\u602a\u7684\u95ee\u9898\uff0c\u5747\u5df2\u7ecf\u5728\u672c\u6587\u4fee\u6b63\uff0c\u5982\u679c\u5728\u914d\u7f6e\u8fc7\u7a0b\u4e2d\u53d1\u73b0\u6709\u5176\u4ed6\u95ee\u9898\uff0c\u5e94\u8be5\u7406\u6e05\u601d\u8def\uff0c\u9010\u70b9\u6392\u67e5\uff0c\u5c06 \u9519\u8bef\u5b9a\u4f4d\u5728\u6700\u5c0f\u7684\u8303\u56f4\u5185\uff0c\u624d\u6709\u5e0c\u671b\u80fd\u89e3\u51b3\u3002 <\/p>\n","protected":false},"author":936,"featured_media":170846,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","ampforwp-amp-on-off":"","home_featured":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[15300],"tags":[8510,8795],"class_list":["post-170845","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-15300","tag-vpn","tag-8795","et-has-post-format-content","et_post_format-et-post-format-standard"],"_links":{"self":[{"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/posts\/170845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/users\/936"}],"replies":[{"embeddable":true,"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/comments?post=170845"}],"version-history":[{"count":0,"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/posts\/170845\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/media\/170846"}],"wp:attachment":[{"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/media?parent=170845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/categories?post=170845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chinadigitaltimes.net\/chinese\/wp-json\/wp\/v2\/tags?post=170845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}