{"id":1669,"date":"2014-08-02T23:08:44","date_gmt":"2014-08-02T17:08:44","guid":{"rendered":"http:\/\/notes.norfolks.org\/?p=1669"},"modified":"2015-08-06T23:47:23","modified_gmt":"2015-08-06T17:47:23","slug":"%d0%bd%d0%b0%d1%81%d1%82%d1%80%d0%be%d0%b9%d0%ba%d0%b0-openvpn","status":"publish","type":"post","link":"https:\/\/notes.norfolks.fun\/?p=1669","title":{"rendered":"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenVPN"},"content":{"rendered":"<p><a href=\"http:\/\/6uestsblog.blogspot.ru\/2008\/07\/openvpn_18.html\">\u041f\u043e\u043b\u043d\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 OpenVPN<\/a><\/p>\n<p><a href=\"http:\/\/www.odmin4eg.ru\/2010\/ubuntu-openvpn-server-nastrojka-soedinenie-filialov-set\/\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a><\/p>\n<pre lang=\"bash\">apt-get install openvpn<\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/p>\n<pre lang=\"bash\">touch \/etc\/openvpn\/server.conf<\/pre>\n<p>\u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 VPN \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u043f\u0430\u043f\u043a\u0435 \/etc\/openvpn \u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c .conf \u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c.<br \/>\n<!--more--><\/p>\n<pre lang=\"bash\">port 1194 #\u041f\u043e\u0440\u0442\r\n proto udp #\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\r\n dev tun   #\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430  \r\n ca \/etc\/openvpn\/ca.crt\r\n cert \/etc\/openvpn\/server.crt\r\n key \/etc\/openvpn\/server.key # This file should be kept secret\r\n dh \/etc\/openvpn\/dh1024.pem\r\n server 10.10.10.0 255.255.255.0 # vpn subnet\r\n ifconfig-pool-persist ipp.txt # \u0422\u0443\u0442 \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f ip \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432\r\n push \"route 192.168.5.0 255.255.255.0\" # home \r\n keepalive 10 120\r\n comp-lzo\r\n user nobody\r\n group nogroup\r\n persist-key\r\n persist-tun\r\n status openvpn-status.log\r\n log-append  openvpn.log\r\n verb 4\r\n mute 20\r\n client-to-client\r\n client-config-dir \/etc\/openvpn\/ccd # \u0422\u0443\u0442 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430\r\n route 192.168.0.0 255.255.255.0 # \u041c\u0430\u0440\u0448\u0440\u0443\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430 1\r\n route 192.168.1.0 255.255.255.0 # \u041c\u0430\u0440\u0448\u0440\u0443\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430 2<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre lang=\"bash\">mkdir \/etc\/openvpn\/ccd<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0438 \u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<pre lang=\"bash\">cd  \/usr\/share\/doc\/openvpn\/examples\/easy-rsa\/2.0\r\nsource .\/vars\r\n .\/clean-all\r\n .\/build-ca<\/pre>\n<p>UPD1<br \/>\n\u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a<\/p>\n<pre lang=\"bash\"># source .\/vars\r\n**************************************************************\r\n   No \/usr\/share\/doc\/openvpn\/examples\/easy-rsa\/2.0\/openssl.cnf file could be found\r\n   Further invocations will fail\r\n**************************************************************\r\n NOTE: If you run .\/clean-all, I will be doing a rm -rf on \/usr\/share\/doc\/openvpn\/examples\/easy-rsa\/2.0\/keys<\/pre>\n<p>\u0438\u043b\u0438 \u0432\u043e\u0442 \u0442\u0430\u043a<\/p>\n<pre lang=\"bash\"># .\/build-ca\r\n grep: \/usr\/share\/doc\/openvpn\/examples\/easy-rsa\/2.0\/openssl.cnf: \u041d\u0435\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\r\n pkitool: KEY_CONFIG (set by the .\/vars script) is pointing to the wrong\r\n version of openssl.cnf: \/usr\/share\/doc\/openvpn\/examples\/easy-rsa\/2.0\/openssl.cnf\r\n The correct version should have a comment that says: easy-rsa version 2.x<\/pre>\n<p>\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0442 \u0444\u0430\u0439\u043b\u0430 openssl.cnf \u044f \u0432\u044b\u0448\u0435\u043b \u0438\u0437 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a<\/p>\n<pre lang=\"bash\">cp \/usr\/share\/doc\/openvpn\/examples\/easy-rsa\/2.0\/openssl-1.0.0.cnf \/usr\/share\/doc\/openvpn\/examples\/easy-rsa\/2.0\/openssl.cnf<\/pre>\n<p>\u0438 \u0442\u0443\u0442 \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043d\u0430 \u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u0433\u0434\u0435 \u0431\u044b\u043b \u043a\u043e\u0441\u044f\u043a.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre lang=\"bash\">.\/build-key-server server<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 (\u0435\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c):<\/p>\n<pre lang=\"bash\">.\/build-key client1<\/pre>\n<p>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u0432\u043e\u0451 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 client1).<br \/>\n\u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Win \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 <a href=\"http:\/\/www.odmin4eg.ru\/2010\/openvpn-win-klient-openvpn-windows-client\/\">\u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0442\u0443\u0442<\/a><br \/>\n\u0435\u0441\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre lang=\"bash\">\r\ncd  \/usr\/share\/doc\/openvpn\/examples\/easy-rsa\/2.0\r\nsource .\/vars\r\n .\/build-key client2<\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0414\u0438\u0444\u0444\u0438-\u0425\u0435\u043b\u043b\u043c\u0430\u043d\u0430:<\/p>\n<pre lang=\"bash\">.\/build-dh<\/pre>\n<p>\u041f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/etc\/openvpn\/<\/p>\n<pre lang=\"bash\">    * ca.crt\r\n     * server.crt\r\n     * dh1024.pem\r\n     * server.key<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \/etc\/openvpn\/ipp.txt<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \/etc\/openvpn\/client.conf \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c<\/p>\n<pre lang=\"bash\">\r\nremote 111.111.111.111 1194\r\n client\r\n dev tun\r\n proto udp\r\n resolv-retry infinite # this is necessary for DynDNS\r\n nobind\r\n user nobody\r\n group nogroup\r\n persist-key\r\n persist-tun\r\n ca \/etc\/openvpn\/ca.crt\r\n cert \/etc\/openvpn\/client1.crt\r\n key \/etc\/openvpn\/client1.key\r\n comp-lzo\r\n verb 4\r\n mute 20\r\n redirect-gateway\r\n#show-net-up\r\n verb 4<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u043f\u0430\u043f\u043a\u0443 \/etc\/openvpn\/ \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043a\u043b\u044e\u0447\u0438 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0442\u0430\u0440\u043d\u044b\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre lang=\"bash\"> * ca.crt\r\n     * client1.crt\r\n     * client1.key<\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0435\u0442\u044c 192.168.1.\u0445 \u0442\u043e, \u0447\u0442\u043e\u0431 \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u0438\u0434\u0435\u043b \u0435\u0451 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043e \u043d\u0435\u0451.<\/p>\n<p>\u041d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \/etc\/openvpn\/ccd\/client1 \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:<\/p>\n<pre lang=\"bash\">iroute 192.168.1.0 255.255.255.0\r\n# \u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u043d\u0430 \u0441\u0435\u0442\u044c \u0444\u0438\u043b\u0438\u0430\u043b\u04302, \u0447\u0442\u043e\u0431 2 \u0444\u0438\u043b\u0438\u0430\u043b\u0430 \u0437\u043d\u0430\u043b\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430\r\n#push \"route 192.168.100.0 255.255.255.0\"\r\n#\u0417\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0432 OpenVPN\r\n push \"redirect-gateway def1\"<\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0443\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0441\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0441\u0430\u043c\u0430\u044f \u0437\u043b\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0443 \u043c\u0435\u043d\u044f.<\/p>\n<p>OpenVPN \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443<\/p>\n<pre lang=\"bash\">push \"redirect-gateway def1\"<\/pre>\n<p>(\u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u2018pull\u2019 \u0432 \u0441\u0432\u043e\u0435\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438), \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u0440\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u0438\u0434\u0430:<\/p>\n<pre lang=\"bash\">0.0.0.0\/1 via 192.168.231.5 dev tun0  \r\n  128.0.0.0\/1 via 192.168.231.5 dev tun0<\/pre>\n<p>\u0438 \u0435\u0441\u043b\u0438 openvpn \u0438\u0434\u0451\u0442 \u043f\u043e ethernet \u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0440\u0430\u0434\u0443\u0435\u0442 \u0430\u0434\u043c\u0438\u043d\u0430 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043d\u043e \u0432\u0435\u043b\u0438\u043a\u0438\u0439 ppp \u043b\u044e\u0431\u0438\u0442 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442.<\/p>\n<pre lang=\"bash\">0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0<\/pre>\n<p>\u0418 \u0432\u043e\u0442 OpenVPN \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a<\/p>\n<pre lang=\"bash\">Jul  2 19:28:53 ino ovpn-client[14465]: NOTE: unable to redirect default gateway -- Cannot read current default gateway from system<\/pre>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u0441\u043a\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u043b\u0433\u043e \u0438 \u043d\u0443\u0434\u043d\u043e, \u0445\u043e\u0442\u044f \u043e\u043d\u043e \u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438. \u0435\u0441\u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u00ab\u043a\u0440\u0438\u0432\u043e\u043c\u00bb \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0435 ppp \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0448\u043b\u044e\u0437 \u0432\u043c\u0435\u0441\u0442\u043e 0.0.0.0 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u043b\u044e\u0437, \u0442\u043e \u041epenVPN \u0432\u0438\u0434\u0438\u0442 \u044d\u0442\u043e\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0444\u0430\u0439\u043b<\/p>\n<pre lang=\"bash\">\/etc\/ppp\/ip-up.d\/routing<\/pre>\n<p>\u0412 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442. (\u043f\u0440\u043e\u0448\u0443 \u043d\u043e\u0433\u0430\u043c\u0438 \u043d\u0435 \u043f\u0438\u043d\u0430\u0442\u044c, \u044f \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u043d\u0438\u0432\u044b\u0439, \u0438 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0448\u043b\u044e\u0437\u0430 \u0438 \u043f\u0440\u0430\u0432\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435 \u0441\u0442\u0430\u043b, \u0430 \u0441\u0434\u0435\u043b\u0430\u043b \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u0441\u0442\u044b\u043b\u044c)<br \/>\n\u0411\u0443\u0434\u0443 \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439, \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439, \u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0430\u0432\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u043b\u0435\u0442\u0443.<br \/>\n \u041f\u043e\u043a\u0430 \u0435\u0449\u0451 \u043d\u0435\u0442 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 100% \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u043e\u0431\u0440\u044b\u0432\u0430\u0445 ppp, \u041d\u043e \u0436\u0438\u0437\u043d\u044c \u043f\u043e\u043a\u0430\u0436\u0435\u0442, \u0435\u0441\u043b\u0438 \u0447\u0442\u043e \u2014 \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u044e \u0442\u043e\u043f\u0438\u043a.<\/p>\n<pre lang=\"sh\">\r\n#! \/bin\/sh \r\n#\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0432\u044b\u0434\u0430\u043d\u043d\u044b\u0439 \u0448\u043b\u044e\u0437 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430  \u0440\u0430\u0437\u043d\u044b\u0439 \u043d\u043e \u0432 \u0441\u0435\u0442\u0438 222.\u0445.\u0445.\u0445\r\ngw1=`ip route show | grep 222 | awk '{print $1}'` \r\n# \u0423\u0434\u0430\u043b\u044f\u0435\u043c 0.0.0.0 0.0.0.0 \r\n route del default \r\n# \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0441 \u0432\u0435\u0440\u043d\u044b\u043c \u0448\u043b\u044e\u0437\u043e\u043c \r\n route add -net default gw ${gw1} dev ppp0<\/pre>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c<\/p>\n<pre lang=\"bash\">chmod ug+x \/etc\/ppp\/ip-up.d\/routing<\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0440\u0435\u0431\u0443\u0442, \u0441\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u043f\u0438\u043d\u0433\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443 \u0438\u043f\u0443, \u043d\u043e \u0441\u0442\u0430\u043b \u043e\u0442\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u2014 10.10.10.26 <\/p>\n<p>\u0417\u042b \u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u043b \u0448\u043b\u044e\u0437\u0430 \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430\u0434\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u044b\u043b \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442.<br \/>\n \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u044f, \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre lang=\"bash\">-A POSTROUTING -s 192.168.0.0\/255.255.0.0 -j MASQUERADE<\/pre>\n<p>\u0422\u0443\u0442 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043d\u0438 \u043a \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443, \u043d\u0438 ip<br \/>\n \u043a\u043e\u0433\u0434\u0430 \u043f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 openvpn \u0442\u043e \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0439 \u0438\u043d\u0435\u0442, \u0430 \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f, \u0442\u043e \u0432\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043b\u0435\u0442\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e.<br \/>\n\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/p>\n<p>\u0412 \u0436\u0438\u0437\u043d\u0438 \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432\u043f\u043d \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0432\u043f\u043d \u043a\u043b\u0438\u0435\u043d\u0442, \u043f\u0438\u043d\u0433\u0443\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0430\u043c 10.10.10.\u0445 \u0434\u0430\u043b\u044c\u0448\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043e \u0441\u0435\u0442\u0435\u0439, \u0447\u0442\u043e \u0441\u0442\u043e\u044f\u0442 \u0437\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c, \u043f\u0438\u043d\u0433\u0443\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443<\/p>\n<pre lang=\"bash\">push \"redirect-gateway def1\"<\/pre>\n<p>\u0418 \u0441\u043d\u043e\u0432\u0430 \u0434\u043e\u0431\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0436\u0438\u0437\u043d\u0438, \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u044f \u0438\u0437 \u043e\u0444\u0438\u0441\u0430, \u043d\u0430 \u0448\u043b\u044e\u0437\u0430\u0445 \u0444\u0438\u043b\u0438\u0430\u043b\u043e\u0432, \u0431\u044b\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u044b \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u0447\u0442\u043e\u0431 \u0430\u0434\u043c\u0438\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0442\u043a\u043d\u0443\u043b \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u043a\u0430\u0431\u0435\u043b\u044f \u0438 \u043f\u0438\u0442\u0430\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u043b \u043c\u043d\u0435, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u044f \u0443\u0436\u0435 \u043f\u043e ssh \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043b\u0430\u0434.<\/p>\n<p>\u041e\u0442\u0437\u044b\u0432 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430<br \/>\n<a href=\"http:\/\/mdex-nn.ru\/page\/blokirovka-sertifikat-openvpn.html\">http:\/\/mdex-nn.ru\/page\/blokirovka-sertifikat-openvpn.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 OpenVPN \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a apt-get install openvpn \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 touch \/etc\/openvpn\/server.conf \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0432\u0441\u0435 VPN \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u043f\u0430\u043f\u043a\u0435 \/etc\/openvpn \u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c .conf \u0443 \u043c\u0435\u043d\u044f \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e &hellip; <a href=\"https:\/\/notes.norfolks.fun\/?p=1669\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,40,8],"tags":[],"class_list":["post-1669","post","type-post","status-publish","format-standard","hentry","category-linux","category-openvpn","category-8"],"_links":{"self":[{"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=\/wp\/v2\/posts\/1669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1669"}],"version-history":[{"count":7,"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=\/wp\/v2\/posts\/1669\/revisions"}],"predecessor-version":[{"id":1917,"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=\/wp\/v2\/posts\/1669\/revisions\/1917"}],"wp:attachment":[{"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.norfolks.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}