{"id":8663,"date":"2024-09-14T09:56:14","date_gmt":"2024-09-14T01:56:14","guid":{"rendered":"http:\/\/999.zuizhuai.cn\/?p=8663"},"modified":"2024-09-14T09:56:14","modified_gmt":"2024-09-14T01:56:14","slug":"%e7%94%a8-openvpn-%e8%bd%bb%e6%9d%be%e5%ae%9e%e7%8e%b0%e5%86%85%e7%bd%91%e7%a9%bf%e9%80%8f%ef%bc%8c%e6%89%93%e9%80%a0%e4%b8%93%e5%b1%9e%e5%ae%89%e5%85%a8%e8%bf%9c%e7%a8%8b%e8%ae%bf%e9%97%ae%e9%80%9a","status":"publish","type":"post","link":"http:\/\/puo.cn\/?p=8663","title":{"rendered":"\u7528 OpenVPN \u8f7b\u677e\u5b9e\u73b0\u5185\u7f51\u7a7f\u900f\uff0c\u6253\u9020\u4e13\u5c5e\u5b89\u5168\u8fdc\u7a0b\u8bbf\u95ee\u901a\u9053"},"content":{"rendered":"<p style=\"text-align: center;margin-bottom: 0px\" data-mpa-powered-by=\"yiban.io\">\n<p style=\"text-align: center;margin-bottom: 0px\"><span style=\"font-size: 10px\">\u94fe\u63a5\uff1ahttps:\/\/www.cnblogs.com\/KingArmy\/p\/18344320<\/span><\/p>\n<p style=\"text-align: center;margin-bottom: 0px\">\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9421\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012252811.png\" width=\"321\" height=\"157\" alt=\"20240916012252811\" title=\"20240916012252811\" \/><\/p>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">1\u3001\u5728\u516c\u6709\u4e91\u642d\u5efaopenvpn\u7684\u670d\u52a1\u7aef<\/span><\/h2>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\"># \u5b89\u88c5openvpn\nyum install openvpn\n<\/span><\/code><\/pre>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u00a0<\/span><\/h2>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">2\u3001\u5b89\u88c5Easy RSA\u5957\u4ef6<\/span><\/h2>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">1\u3001\u7528\u4e8e\u751f\u6210openVPN\u6240\u9700\u7684\u5bc6\u94a5\uff0c\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u6240\u9700\u7684\u8bc1\u4e66\u548c\u5bc6\u94a5<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\"># \u4e0b\u8f7dEasy RSA\u6e90\u7801\u5305\n1\u3001\u4e0b\u8f7d\u5730\u5740\uff1a\n\thttps:\/\/github.com\/OpenVPN\/easy-rsa\/releases\n2\u3001\u4e0b\u8f7d\u6e90\u7801\u5305\n\twget https:\/\/github.com\/OpenVPN\/easy-rsa\/releases\/download\/v3.1.2\/EasyRSA-3.1.2.tgz\n3\u3001\u79fb\u52a8\u5230\u56fa\u5b9a\u4f4d\u7f6e\n\tmv EasyRSA-3.1.2 \/etc\/openvpn\/easy-rsa\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">2\u3001\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u628avars.example\u6837\u4f8b\u6587\u4ef6\u91cd\u547d\u540d\u4e3avars\uff0c\u7136\u540e\u7f16\u8f91\n2\u3001\u641c\u7d22 set_var EASYRSA_CA_EXPIRE \u8bbe\u7f6e\u8bc1\u4e66\u6709\u6548\u671f\u4e00\u5e74\n3\u3001\u641c\u7d22 set_var EASYRSA_CERT_EXPIRE \u8bbe\u7f6e\u670d\u52a1\u6709\u6548\u671f\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">3\u3001\u4f7f\u7528Easy RSA\u5728\u670d\u52a1\u7aef\u751f\u6210\u79c1\u94a5\u548c\u8bc1\u4e66<\/span><\/h3>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9422\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012252499.png\" width=\"1080\" height=\"565\" alt=\"20240916012252499\" title=\"20240916012252499\" \/><\/p>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u4f7f\u7528easyrsa\u6e05\u7406\u539f\u6709\u8bc1\u4e66\u548c\u79c1\u94a5\uff1a\n\t\t.\/easyrsa clean-all\n2\u3001\u751f\u6210CA\u6839\u8bc1\u4e66\uff1a\n\t\t.\/easyrsa build-ca\n\t\t\u8fd9\u91cc\u8f93\u5165\u4e24\u4e2a\u6839\u5bc6\u7801\uff0c\u7b2c\u4e09\u6b21\u56de\u8f66\u5373\u53ef\n3\u3001\u8bc1\u4e66\u751f\u6210\u4f4d\u7f6e\n\t\t\/etc\/openvpn\/easy-rsa\/pki\/ca.crt\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">4\u3001\u4e3aOpenVPN\u670d\u52a1\u7aef\u751f\u6210server\u8bc1\u4e66\u548c\u79c1\u94a5<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u4f7f\u7528nopass\u53c2\u6570\u8bbe\u7f6e\u4e0d\u9700\u8981\u5bc6\u7801\uff0c\u90a3\u4e48\u5728\u542f\u52a8OpenVPN\u670d\u52a1\u7684\u65f6\u5019\u5c31\u4e0d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\n\t\t.\/easyrsa build-server-full server nopass\n2\u3001\u8bc1\u4e66\u548c\u5bc6\u94a5\u7684\u4f4d\u7f6e\n\t\t\u670d\u52a1\u7aef\u8bc1\u4e66\u8def\u5f84\uff1a\/etc\/openvpn\/easy-rsa\/pki\/issued\/server.crt\n\t\t\u670d\u52a1\u7aef\u79c1\u94a5\u8def\u5f84\uff1a\/etc\/openvpn\/easy-rsa\/pki\/private\/server.key\n3\u3001\u751f\u6210Diffie-Hellman\u7b97\u6cd5\u9700\u8981\u7684\u5bc6\u94a5\u6587\u4ef6:\n\t\t.\/easyrsa gen-dh\n4\u3001\u751f\u6210tls-auth Key\u7528\u4e8e\u9632\u6b62DDOS\u548cTLS\u653b\u51fb:\n\t\topenvpn --genkey --secret ta.key\n5\u3001ta.key\u8def\u5f84\n\t\t\/etc\/openvpn\/easy-rsa\/ta.key\n<\/span><\/code><\/pre>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u00a0<\/span><\/h2>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">3\u3001OpenVPN\u670d\u52a1\u7aef\u914d\u7f6e<\/span><\/h2>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">1\u3001\u521b\u5efa\u4fee\u6539\u670d\u52a1\u7aef\u914d\u7f6e\u6587\u4ef6<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u914d\u7f6e\u6587\u4ef6\u4f4d\u7f6e\uff1a\/etc\/openvpn\/server\/server.conf\n\t\tvim \/etc\/openvpn\/server\/server.conf\n======================================    BEGIN   ===========================================\nport 1194                               #\u7aef\u53e3\ndev tun                                 #\u91c7\u7528\u8def\u7531\u96a7\u9053\u6a21\u5f0ftun\nca ca.crt                               #ca\u8bc1\u4e66\u6587\u4ef6\u4f4d\u7f6e\ncert server.crt                         #\u670d\u52a1\u7aef\u516c\u94a5\u540d\u79f0\nkey server.key                          #\u670d\u52a1\u7aef\u79c1\u94a5\u540d\u79f0\ndh dh.pem                               #\u4ea4\u6362\u8bc1\u4e66\nauth SHA1\nproto tcp\nserver 10.8.0.0 255.255.255.0           #\u7ed9\u5ba2\u6237\u7aef\u5206\u914d\u5730\u5740\u6c60\uff0c\u6ce8\u610f\uff1a\u4e0d\u80fd\u548cVPN\u670d\u52a1\u5668\u5185\u7f51\u7f51\u6bb5\u6709\u76f8\u540c\npush \"route 10.0.8.2 255.255.252.0\"   #\u5141\u8bb8\u5ba2\u6237\u7aef\u8bbf\u95ee\u5185\u7f5110.0.8.2\u7f51\u6bb5\uff0c\u6211\u8fd9\u91cc\u586b\u4e86\u670d\u52a1\u5668\u5185\u7f51IP\u548c\u5b50\u7f51\u63a9\u7801\nclient-to-client\nverb 3                                  #openvpn\u7248\u672c\npersist-key     #\u901a\u8fc7keepalive\u68c0\u6d4b\u8d85\u65f6\u540e\uff0c\u91cd\u65b0\u542f\u52a8VPN\uff0c\u4e0d\u91cd\u65b0\u8bfb\u53d6keys\uff0c\u4fdd\u7559\u7b2c\u4e00\u6b21\u4f7f\u7528\u7684keys\u3002\npersist-tun     #\u68c0\u6d4b\u8d85\u65f6\u540e\uff0c\u91cd\u65b0\u542f\u52a8VPN\uff0c\u4e00\u76f4\u4fdd\u6301tun\u662flinkup\u7684\u3002\u5426\u5219\u7f51\u7edc\u4f1a\u5148linkdown\u7136\u540e\u518dlinkup\nkeepalive 10 120                        #\u5b58\u6d3b\u65f6\u95f4\uff0c10\u79d2ping\u4e00\u6b21,120 \u5982\u672a\u6536\u5230\u54cd\u5e94\u5219\u89c6\u4e3a\u65ad\u7ebf\nmax-clients 200                         #\u6700\u591a\u5141\u8bb8200\u4e2a\u5ba2\u6237\u7aef\u8fde\u63a5\nifconfig-pool-persist ipp.txt           #\u5730\u5740\u6c60\u8bb0\u5f55\u6587\u4ef6\u4f4d\u7f6e \u7ef4\u6301\u5ba2\u6237\u7aef\u548cvirtual ip\u7684\u5bf9\u5e94\u8868\uff0c\u4ee5\u4fbf\u5ba2\u6237\u7aef\u91cd\u8fde\u63a5\u8fde\u63a5\u4e5f\u662f\u76f8\u540cIP\nduplicate-cn    #\u548ckeys\u8fde\u63a5VPN\uff0c\u4e00\u5b9a\u8981\u6253\u5f00\u8fd9\u4e2a\u9009\u9879\uff0c\u5426\u5219\u53ea\u5141\u8bb8\u4e00 \u4e2a\u4eba\u8fde\u63a5VPN\nscript-security 3                                   #\u652f\u6301\u5bc6\u7801\u8ba4\u8bc1-\u5141\u8bb8\u4f7f\u7528\u81ea\u5b9a\u4e49\u811a\u672c\nauth-user-pass-verify \/etc\/openvpn\/check.sh via-env #\u652f\u6301\u5bc6\u7801\u8ba4\u8bc1-\u6307\u5b9a\u8ba4\u8bc1\u811a\u672c\nusername-as-common-name                             #\u652f\u6301\u5bc6\u7801\u8ba4\u8bc1-\u7528\u6237\u5bc6\u7801\u767b\u9646\u65b9\u5f0f\u9a8c\u8bc1\n======================================     END    ===========================================\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">2\u3001\u7f16\u5199\u7528\u6237\u8ba4\u8bc1\u811a\u672c\u6587\u4ef6<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u811a\u672c\u6587\u4ef6\u4f4d\u7f6e\uff1a\/etc\/openvpn\/check.sh\n\t\tvim \/etc\/openvpn\/check.sh\n======================================    BEGIN \u5199\u5165\u4e0b\u9762\u5185\u5bb9  ===========================================\n#!\/bin\/bash\nPASSFILE=\"\/etc\/openvpn\/openvpnfile\"   #\u5bc6\u7801\u6587\u4ef6 \u7528\u6237\u540d \u5bc6\u7801\u660e\u6587\nLOG_FILE=\"\/var\/log\/openvpn-password.log\"  #\u7528\u6237\u767b\u5f55\u60c5\u51b5\u7684\u65e5\u5fd7\nTIME_STAMP=`date \"+%Y-%m-%d %T\"`\nif [ ! -r \"${PASSFILE}\" ]; then\n    echo \"${TIME_STAMP}: Could not open password file \"${PASSFILE}\" for reading.\" &gt;&gt; ${LOG_FILE}\n    exit 1\nfi\nCORRECT_PASSWORD=`awk '!\/^;\/&amp;&amp;!\/^#\/&amp;&amp;$1==\"'${username}'\"{print $2;exit}'    ${PASSFILE}`\nif [ \"${CORRECT_PASSWORD}\" = \"\" ]; then\n    echo \"${TIME_STAMP}: User does not exist: username=\"${username}\",password=\"${password}\".\" &gt;&gt; ${LOG_FILE}\n    exit 1\nfi\nif [ \"${password}\" = \"${CORRECT_PASSWORD}\" ]; then\n    echo \"${TIME_STAMP}: Successful authentication: username=\"${username}\".\" &gt;&gt; ${LOG_FILE}\n    exit 0\nfi\necho \"${TIME_STAMP}: Incorrect password: username=\"${username}\", password=\"${password}\".\" &gt;&gt; ${LOG_FILE}\nexit 1\n======================================     END    ===========================================\n\n2\u3001\u7ed9\u811a\u672c\u53ef\u6267\u884c\u6743\u9650\n\tchmod +x \/etc\/openvpn\/check.sh\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">3\u3001\u521b\u5efa\u7528\u6237\u5bc6\u7801<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u6587\u4ef6\u5bc6\u7801\u5b58\u50a8\u6587\u4ef6\u4f4d\u7f6e\uff1a\/etc\/openvpn\/openvpnfile\n2\u3001\u5185\u5bb9\u683c\u5f0f:\u6bcf\u884c\u5bf9\u5e94\u4e00\u4e2a\u8d26\u53f7\u5bc6\u7801\n\t\tkoten 1\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">4\u3001\u79fb\u52a8\u76f8\u5173\u5bc6\u94a5\u6587\u4ef6\u542f\u52a8\u670d\u52a1<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u62f7\u8d1d\u79c1\u94a5\u3001\u516c\u94a5\u548c\u8bc1\u4e66\u7b49\u6587\u4ef6\u5230server.conf\u540c\u7ea7\u76ee\u5f55\/etc\/openvpn\/server\/\u4e0b\n\t\u6ce8\uff1a\u9700\u8981\u62f7\u8d1d\u7684\u6587\u4ef6\u5305\u62ecca.crt\u3001ca.key\u3001server.crt\u3001server.key\u3001dh.pem\u3001ta.key\n\tcp \/etc\/openvpn\/easy-rsa\/pki\/ca.crt\n\tcp \/etc\/openvpn\/easy-rsa\/pki\/private\/ca.key\n\tcp \/etc\/openvpn\/easy-rsa\/pki\/issued\/server.crt\n\tcp \/etc\/openvpn\/easy-rsa\/pki\/private\/server.key\n\tcp \/etc\/openvpn\/easy-rsa\/pki\/dh.pem\n\tcp \/etc\/openvpn\/easy-rsa\/ta.key\n\n2\u3001\u542f\u52a8\u670d\u52a1\uff1a\u4f7f\u7528--config path \u6307\u5b9a\u914d\u7f6e\u6587\u4ef6\n\topenvpn --config server.conf\n<\/span><\/code><\/pre>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u5230\u8fd9\u91cc\u6211\u4eec\u7684\u670d\u52a1\u7aef\u5c31\u642d\u5efa\u597d\u4e86\uff0c\u4f7f\u7528ifconfig\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u7684\u670d\u52a1\u7aef\u5df2\u7ecf\u7ed9\u81ea\u5df1\u5206\u914d\u4e86\u4e00\u4e2a10.8.0.1\u7684\u865a\u62dfIP<\/span><\/h2>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9423\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012255265.png\" width=\"1080\" height=\"1028\" alt=\"20240916012255265\" title=\"20240916012255265\" \/><\/p>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u00a0<\/span><\/h2>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">4\u3001\u5ba2\u6237\u7aef\u914d\u7f6e<\/span><\/h2>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">1\u3001\u5b89\u88c5openVPn<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\"># \u5b89\u88c5openvpn\nyum install openvpn\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">2\u3001\u5728\u670d\u52a1\u7aef\u751f\u6210\u5ba2\u6237\u7aef\u7684\u8bc1\u4e66\u548c\u79c1\u94a5\uff0c\u6bcf\u4e2a\u5ba2\u6237\u7aef\u90fd\u8981\u6709\u81ea\u5df1\u7684\u79c1\u94a5<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u5728\/etc\/openvpn\/easy-rsa\/ \u76ee\u5f55\u4e0b\u6267\u884c\n\t.\/easyrsa build-client-full client nopass\n\t\u6ce8\u26a0\ufe0f\uff1a\u751f\u6210\u7684\u65f6\u5019\u9700\u8981\u8f93\u5165CA\u6839\u8bc1\u4e66\u7684\u5bc6\u7801\n2\u3001\u751f\u6210\u7684\u8bc1\u4e66\u4f4d\u7f6e\n\t\u5ba2\u6237\u7aef\u8bc1\u4e66\u8def\u5f84\uff1a\/etc\/openvpn\/easy-rsa\/pki\/issued\/client.crt\n\t\u5ba2\u6237\u7aef\u79c1\u94a5\u8def\u5f84\uff1a\/etc\/openvpn\/easy-rsa\/pki\/private\/client.key\n3\u3001\u5c06\u751f\u6210\u7684\u5ba2\u6237\u7aef\u8bc1\u4e66\uff08client.crt)\u3001\u79c1\u94a5(client.key)\uff0c\u670d\u52a1\u7aef\u6839\u8bc1\u4e66(ca.crt)\u3001ta.key\u6253\u5305\u653e\u5230\u5ba2\u6237\u7aef\u7684 \/etc\/openvpn\/client\u4f4d\u7f6e\n\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">3\u3001\u521b\u5efa\/\u4fee\u6539OpenVPN\u5ba2\u6237\u7aef\u914d\u7f6e\u6587\u4ef6<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\nclient\ndev tun\nproto tcp\nremote xx.xx.xx.xx 1194\nca ca.crt               #\u6307\u5b9aCA\u8bc1\u4e66\u7684\u6587\u4ef6\u8def\u5f84\ncert client.crt         #\u6307\u5b9a\u5f53\u524d\u5ba2\u6237\u7aef\u7684\u8bc1\u4e66\u6587\u4ef6\u8def\u5f84\nkey client.key          #\u6307\u5b9a\u5f53\u524d\u5ba2\u6237\u7aef\u7684\u79c1\u94a5\u6587\u4ef6\u8def\u5f84\nnobind                  #\u4e0d\u7ed1\u5b9a\u672c\u5730\u7279\u5b9a\u7684\u7aef\u53e3\u53f7\nauth SHA1\nresolv-retry infinite   #\u65ad\u7ebf\u81ea\u52a8\u91cd\u65b0\u8fde\u63a5\uff0c\u5728\u7f51\u7edc\u4e0d\u7a33\u5b9a\u7684\u60c5\u51b5\u4e0b\u975e\u5e38\u6709\u7528\nverb 3                  #\u6307\u5b9a\u65e5\u5fd7\u6587\u4ef6\u7684\u8bb0\u5f55\u8be6\u7ec6\u7ea7\u522b\uff0c\u53ef\u90090-9\uff0c\u7b49\u7ea7\u8d8a\u9ad8\u65e5\u5fd7\u5185\u5bb9\u8d8a\u8be6\u7ec6\npersist-key     #\u901a\u8fc7keepalive\u68c0\u6d4b\u8d85\u65f6\u540e\uff0c\u91cd\u65b0\u542f\u52a8VPN\uff0c\u4e0d\u91cd\u65b0\u8bfb\u53d6keys\uff0c\u4fdd\u7559\u7b2c\u4e00\u6b21\u4f7f\u7528\u7684keys\npersist-tun     #\u68c0\u6d4b\u8d85\u65f6\u540e\uff0c\u91cd\u65b0\u542f\u52a8VPN\uff0c\u4e00\u76f4\u4fdd\u6301tun\u662flinkup\u7684\u3002\u5426\u5219\u7f51\u7edc\u4f1a\u5148linkdown\u7136\u540e\u518dlinkup\nauth-user-pass pass.txt  #\u7528\u6237\u5bc6\u7801\u9a8c\u8bc1\n======================================     END    ===========================================\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">4\u3001\u521b\u5efa\u8d26\u53f7\u5bc6\u7801\u6587\u4ef6<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">1\u3001\/etc\/openvpn\/client\u4e0b\u521b\u5efa\u7528\u6237\u5bc6\u7801\u6587\u4ef6pass.txt\uff1a\u683c\u5f0f\u7b2c\u4e00\u884c\u8d26\u53f7\uff0c\u7b2c\u4e8c\u884c\u5bc6\u7801\uff0c\u5982\uff1a\n\t\u5f20\u4e09\n\t123456\n<\/span><\/code><\/pre>\n<h3 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">5\u3001\u542f\u52a8\u5ba2\u6237\u7aef<\/span><\/h3>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\"># \u542f\u52a8\u5ba2\u6237\u7aef\n1\u3001openvpn --config client.conf\n\u89c2\u5bdf\u4e0b\u56fe\uff1a\u5df2\u7ecf\u4e3a\u6211\u4eec\u5206\u914d\u7684\u5bf9\u5e94\u7684\u865a\u62dfIP\uff0c\u901a\u8fc7\u8fd9\u4e2aIP\u5728\u8fd9\u4e2a\u7f51\u6bb5\u5185\u7684\u673a\u5668\u90fd\u53ef\u4ee5\u4e92\u901a\u4e86\n<\/span><\/code><\/pre>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9424\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012259230.png\" width=\"1080\" height=\"850\" alt=\"20240916012259230\" title=\"20240916012259230\" \/><\/p>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u00a0<\/span><\/h2>\n<h2 style=\"margin-top: 10px;margin-bottom: 10px;font-weight: bold;font-size: 21px;line-height: 1.5;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">5\u3001\u5728\u6211\u4eec\u81ea\u5df1\u7684\u7535\u8111\u76f4\u63a5\u4f7f\u7528VPN\u8bbf\u95ee\u5185\u7f51<\/span><\/h2>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u5206\u522b\u914d\u7f6e\u5728Windows\u548cMac\u4e0a\u4f7f\u7528\u4e0b\u8f7d\u5730\u5740\uff1ahttps:\/\/openvpn.net\/client\/<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">1\u3001Windows\u5ba2\u6237\u7aef\u4e0b\u8f7d\uff1a<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">https:\/\/swupdate.openvpn.org\/community\/releases\/OpenVPN-2.6.12-I001-arm64.msi<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">2\u3001Mac\u5ba2\u6237\u7aef\u4e0b\u8f7d<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">https:\/\/swupdate.openvpn.net\/downloads\/connect\/openvpn-connect-3.4.9.4830_signed.dmg<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">3\u3001\u4ee5Mac\u4e3a\u4f8b<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u628a\u4e0a\u9762\u8bf4\u5230\u7684Easy RSA\u751f\u6210\u7684\u670d\u52a1\u5668\u6839\u8bc1\u4e66ca.crt\u3001\u5ba2\u6237\u7aef\u79c1\u94a5clientpc.key\u3001\u8bc1\u4e66client.crt\uff0c\u548cta.key\u590d\u5236\u5230\u4e00\u4e2a\u76ee\u5f55\u4e0b\u9762<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u7136\u540e\u65b0\u5efa\u4e00\u4e2aclient.ovpn\u6587\u4ef6<\/span><\/p>\n<pre style=\"margin: 10px auto;overflow: auto;font-size: 13px;letter-spacing: normal;text-align: left\"><code style=\"padding: 1em;, sans-serif;font-size: 12px;border-width: 1px;border-style: solid;border-radius: 3px;line-height: 1.5\"><span style=\"font-size: 18px\">client\ndev tun\nproto tcp\nremote 41.19.18.17 1194\nca ca.crt               #\u6307\u5b9aCA\u8bc1\u4e66\u7684\u6587\u4ef6\u8def\u5f84\ncert client.crt         #\u6307\u5b9a\u5f53\u524d\u5ba2\u6237\u7aef\u7684\u8bc1\u4e66\u6587\u4ef6\u8def\u5f84\nkey client.key          #\u6307\u5b9a\u5f53\u524d\u5ba2\u6237\u7aef\u7684\u79c1\u94a5\u6587\u4ef6\u8def\u5f84\nnobind                  #\u4e0d\u7ed1\u5b9a\u672c\u5730\u7279\u5b9a\u7684\u7aef\u53e3\u53f7\nauth SHA1\nresolv-retry infinite   #\u65ad\u7ebf\u81ea\u52a8\u91cd\u65b0\u8fde\u63a5\uff0c\u5728\u7f51\u7edc\u4e0d\u7a33\u5b9a\u7684\u60c5\u51b5\u4e0b\u975e\u5e38\u6709\u7528\nverb 3                  #\u6307\u5b9a\u65e5\u5fd7\u6587\u4ef6\u7684\u8bb0\u5f55\u8be6\u7ec6\u7ea7\u522b\uff0c\u53ef\u90090-9\uff0c\u7b49\u7ea7\u8d8a\u9ad8\u65e5\u5fd7\u5185\u5bb9\u8d8a\u8be6\u7ec6\npersist-key     #\u901a\u8fc7keepalive\u68c0\u6d4b\u8d85\u65f6\u540e\uff0c\u91cd\u65b0\u542f\u52a8VPN\uff0c\u4e0d\u91cd\u65b0\u8bfb\u53d6keys\uff0c\u4fdd\u7559\u7b2c\u4e00\u6b21\u4f7f\u7528\u7684keys\npersist-tun     #\u68c0\u6d4b\u8d85\u65f6\u540e\uff0c\u91cd\u65b0\u542f\u52a8VPN\uff0c\u4e00\u76f4\u4fdd\u6301tun\u662flinkup\u7684\u3002\u5426\u5219\u7f51\u7edc\u4f1a\u5148linkdown\u7136\u540e\u518dlinkup\nauth-user-pass pass.txt  #\u7528\u6237\u5bc6\u7801\u9a8c\u8bc1\n<\/span><\/code><\/pre>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u65b0\u5efapass.txt \u6587\u4ef6,\u4e0e\u5ba2\u6237\u7aef\u7684\u8d26\u53f7\u5bc6\u7801\u89c4\u5219\u4e00\u6837\uff0c\u7b2c\u4e00\u884c\u4e3a\u8d26\u6237\uff0c\u7b2c\u4e8c\u884c\u5bc6\u7801<br \/>\n<\/span><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9425\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012301710.png\" width=\"406\" height=\"388\" alt=\"20240916012301710\" title=\"20240916012301710\" \/><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u70b9\u51fb\u5bfc\u5165\u914d\u7f6e\u6587\u4ef6<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9426\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012302738.png\" width=\"800\" height=\"1370\" alt=\"20240916012302738\" title=\"20240916012302738\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9427\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012304761.png\" width=\"1080\" height=\"644\" alt=\"20240916012304761\" title=\"20240916012304761\" \/><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9428\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012306336.png\" width=\"800\" height=\"1370\" alt=\"20240916012306336\" title=\"20240916012306336\" \/><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u8fd9\u6837\u5c31\u8fde\u4e0a\u4e86\uff0c\u89c2\u5bdf\u672c\u5730IP\uff0c\u53d1\u73b0\u4e3a\u6211\u4eec\u4e5f\u5206\u914d\u4e86\u4e00\u4e2a\u865a\u62dfIP<\/span><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9429\" src=\"http:\/\/loc-wp-cdnimg.jiyun.net\/blogtest\/2024\/09\/20240916012309948.png\" width=\"1080\" height=\"653\" alt=\"20240916012309948\" title=\"20240916012309948\" \/><\/p>\n<p style=\"margin: 10px auto;line-height: 1.5;font-size: 13px;, helvetica, arial, sans-serif;letter-spacing: normal;text-align: left\"><span style=\"font-size: 18px\">\u5728\u6211\u4eec\u672c\u5730\u5c31\u53ef\u4ee5\u968f\u610f\u8bbf\u95ee\u5185\u7f51\u7f51\u7edc\u4e86<\/span><\/p>\n<section style=\"margin-bottom: 0px\" data-support=\"96\u7f16\u8f91\u5668\" data-style-id=\"26631\">\n<section style=\"text-align: center;margin-top: 10px;margin-bottom: 10px\">\n<section style=\"border-radius: 0px 15px 15px;padding-left: 8px\">\n<section style=\"border-radius: 0px 15px 15px;padding-left: 8px\">\n<section style=\"background-image: linear-gradient(90deg, rgba(170, 202, 253, 0.98) 10%, rgba(40, 111, 225, 0.945) 100%);border-radius: 0px 15px 15px;padding: 3px 15px\">\n<p style=\"letter-spacing: 2px\"><strong>END<\/strong><\/p>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u94fe\u63a5\uff1ahttps:\/\/www.cnblogs.com\/KingArmy\/p\/18344320 1\u3001\u5728\u516c\u6709\u4e91\u642d\u5efaopenvpn\u7684\u670d\u52a1\u7aef # \u5b89\u88c5openvpn yum install openvpn \u00a0 2\u3001\u5b89\u88c5Easy RSA\u5957\u4ef6 1\u3001\u7528\u4e8e&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[141],"tags":[186],"topic":[],"class_list":["post-8663","post","type-post","status-publish","format-standard","hentry","category-tools-soft","tag-vpn"],"_links":{"self":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/8663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8663"}],"version-history":[{"count":0,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/8663\/revisions"}],"wp:attachment":[{"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8663"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8663"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=8663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}