{"id":306819,"date":"2020-07-12T21:01:09","date_gmt":"2020-07-12T21:01:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306819"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306819","title":{"rendered":"\u041f\u0440\u043e\u0441\u0442\u043e\u0439 UDP hole punching \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 IPIP-\u0442\u0443\u043d\u043d\u0435\u043b\u044f"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/509730\/\">\u0414\u043e\u0431\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0442\u043e\u043a!<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b (<a href=\"https:\/\/habr.com\/ru\/post\/481034\/\">\u0435\u0449\u0435 \u043e\u0434\u0438\u043d<\/a>) \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 Bash \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u0437\u0430 NAT, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 UDP hole punching \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u041e\u0421 Ubuntu\/Debian.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0448\u0430\u0433\u043e\u0432:<\/p>\n<ol>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a \u0443\u0437\u043b\u0430 \u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430;<\/li>\n<li>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 UDP-\u043f\u043e\u0440\u0442\u0430;<\/li>\n<li>\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 UDP-\u043f\u043e\u0440\u0442\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0443\u0437\u043b\u0443;<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 UDP-\u043f\u043e\u0440\u0442\u0430 \u043e\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430;<\/li>\n<li>\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f IPIP-\u0442\u0443\u043d\u043d\u0435\u043b\u044f;<\/li>\n<li>\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f;<\/li>\n<li>\u041f\u0440\u0438 \u043e\u0431\u0440\u044b\u0432\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c IPIP \u0442\u0443\u043d\u043d\u0435\u043b\u044c.<\/li>\n<\/ol>\n<p>  \u042f \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u043b \u0438 \u0435\u0449\u0435 \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0437\u043b\u0430\u043c\u0438, \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u042f\u043d\u0434\u0435\u043a\u0441.\u0434\u0438\u0441\u043a. <\/p>\n<ul>\n<li> \u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u2014 \u043d\u0443\u0436\u043d\u043e 3 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f: \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u0443\u0434\u0430\u043b\u0438\u0442\u044c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e curl \u044d\u0442\u043e:<br \/>   \u0421\u043e\u0437\u0434\u0430\u0442\u044c:\n<pre><code class=\"bash\">curl -s -X MKCOL --user &quot;$usename:$password&quot; https:\/\/webdav.yandex.ru\/$folder<\/code><\/pre>\n<p>   \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c:   <\/p>\n<pre><code class=\"bash\">curl -s --user &quot;$usename:$password&quot; -X PROPFIND -H &quot;Depth: 1&quot; https:\/\/webdav.yandex.ru\/$folder<\/code><\/pre>\n<p>   \u0423\u0434\u0430\u043b\u0438\u0442\u044c:<\/p>\n<pre><code class=\"bash\">curl -s -X DELETE --user &quot;$usename:$password&quot; https:\/\/webdav.yandex.ru\/$folder<\/code><\/pre>\n<\/li>\n<li> \u0412\u043e \u0432\u0442\u043e\u0440\u044b\u0445, \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0432 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435:\n<pre><code class=\"bash\">apt install curl<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 UDP-\u043f\u043e\u0440\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f stun-client \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">stun stun.sipnet.ru -v -p $1 2&gt;&amp;1 | grep &quot;MappedAddress&quot;<\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">apt install stun-client<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0448\u0442\u0430\u0442\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u041e\u0421 \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 iproute2. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/457386\/\">\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0443\u043d\u043d\u0435\u043b\u0435\u0439<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 (L2TPv3, GRE \u0438 \u0442.\u043f.), \u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b IPIP \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u042f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b L2TPv3 \u043f\u043e\u0432\u0435\u0440\u0445 UDP \u0438 \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u043b\u0441\u044f, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0443\u043f\u0430\u043b\u0430 \u0432 10 \u0440\u0430\u0437, \u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430\u043c\u0438 \u0438\u043b\u0438 \u0435\u0449\u0435 \u0447\u0435\u0433\u043e-\u0442\u043e. \u0422\u0430\u043a \u043a\u0430\u043a IPIP-\u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 IP, \u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f FOU-\u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 UDP-\u043f\u043e\u0440\u0442\u043e\u0432. \u0414\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 IPIP-\u0442\u0443\u043d\u043d\u0435\u043b\u044f \u043d\u0443\u0436\u043d\u043e:<\/p>\n<p>   \u2014 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c FOU:<\/p>\n<pre><code class=\"bash\">modprobe fou<\/code><\/pre>\n<p>   \u2014 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u0442:<\/p>\n<pre><code class=\"bash\">ip fou add port $localport ipproto 4<\/code><\/pre>\n<p>   \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0443\u043d\u043d\u0435\u043b\u044c:<\/p>\n<pre><code class=\"bash\">ip link add name fou$name type ipip remote $remoteip local $localip encap fou  encap-sport $localport encap-dport $remoteport<\/code><\/pre>\n<p>   \u2014 \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0442\u0443\u043d\u043d\u0435\u043b\u044f:<\/p>\n<pre><code class=\"bash\">ip link set up dev fou$name<\/code><\/pre>\n<p>   \u2014 \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 IP-\u0430\u0434\u0440\u0435\u0441 \u0442\u0443\u043d\u0435\u043b\u044f:<\/p>\n<pre><code class=\"bash\">ip addr add $intIP peer $peerip dev fou$name<\/code><\/pre>\n<p>  \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0443\u043d\u043d\u0435\u043b\u044c:<\/p>\n<pre><code class=\"bash\">ip link del dev fou$name<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"bash\">ip fou del port $localport<\/code><\/pre>\n<p>  \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0438\u043d\u0433\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430, \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">ping -c 1 $peerip -s 0<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0438\u043d\u0433 \u043d\u0443\u0436\u0435\u043d \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u043d\u0430 \u0440\u043e\u0443\u0442\u0435\u0440\u0430\u0445 \u043c\u043e\u0433\u0443\u0442 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b NAT \u0438 \u0442\u043e\u0433\u0434\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043e\u0440\u0432\u0435\u0442\u0441\u044f.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043f\u0438\u043d\u0433 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442, \u0442\u043e IPIP-\u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438 \u0436\u0434\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043e\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430.<\/p>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash username=&quot;username@yandex.ru&quot; password=&quot;password&quot; folder=&quot;vpnid&quot; intip=&quot;10.0.0.1&quot; localport=`shuf -i 10000-65000 -n 1` cid=`shuf -i 10000-99999 -n 1` tid=`shuf -i 10-99 -n 1` function yaread {         curl -s --user &quot;$1:$2&quot; -X PROPFIND -H &quot;Depth: 1&quot; https:\/\/webdav.yandex.ru\/$3 | sed 's\/&gt;&lt;\/&gt;\\n&lt;\/g' | grep &quot;displayname&quot; | sed 's\/&lt;d:displayname&gt;\/\/g' | sed 's\/&lt;\\\/d:displayname&gt;\/\/g' | grep -v $3 | grep -v $4 | sort -r } function yacreate {         curl -s -X MKCOL --user &quot;$1:$2&quot; https:\/\/webdav.yandex.ru\/$3 } function yadelete {         curl -s -X DELETE --user &quot;$1:$2&quot; https:\/\/webdav.yandex.ru\/$3 } function myipport {         stun stun.sipnet.ru -v -p $1 2&gt;&amp;1 | grep &quot;MappedAddress&quot; | sort | uniq | awk '{print $3}' | head -n1 } function tunnel-up { \tmodprobe fou \tip fou add port $4 ipproto 4 \tip link add name fou$7 type ipip remote $1 local $3 encap fou encap-sport $4 encap-dport $2 \tip link set up dev fou$7 \tip addr add $6 peer $5 dev fou$7 } function tunnel-check { \tsleep 10         pings=0         until [[ $pings == 4 ]]; do                 if ping -c 1 $1 -s 0 &amp;&gt;\/dev\/null;                         then    echo -n .; n=0                         else    echo -n !; ((pings++))                 fi \t\tsleep 15         done } function tunnel-down { \tip link del dev fou$1 \tip fou del port $2 } trap 'echo -e &quot;\\nDisconnecting...&quot; &amp;&amp; yadelete $username $password $folder; tunnel-down $tunnelid $localport; echo &quot;IPIP tunnel disconnected!&quot;; exit 1' 1 2 3 8 9 14 15 until [[ -n $end ]]; do     yacreate $username $password $folder     until [[ -n $ip ]]; do         mydate=`date +%s`         timeout=&quot;60&quot;         list=`yaread $username $password $folder $cid | head -n1`         yacreate $username $password $folder\/$mydate:$cid         for l in $list; do                 if [ `echo $l | sed 's\/:\/ \/g' | awk {'print $1'}` -ge $(($mydate-65)) ]; then \t\t\t#echo $list                         myipport=`myipport $localport`                         yacreate $username $password $folder\/$mydate:$cid:$myipport:$intip:$tid                         timeout=$(( $timeout + `echo $l | sed 's\/:\/ \/g' | awk {'print $1'}` - $mydate + 3 ))                         ip=`echo $l | sed 's\/:\/ \/g' | awk '{print $3}'`                         port=`echo $l | sed 's\/:\/ \/g' | awk '{print $4}'`                         peerip=`echo $l | sed 's\/:\/ \/g' | awk '{print $5}'` \t\t\tpeerid=`echo $l | sed 's\/:\/ \/g' | awk '{print $6}'` \t\t\tif [[ -n $peerid ]]; then tunnelid=$(($peerid*$tid)); fi                 fi         done         if ( [[ -z &quot;$ip&quot; ]] &amp;&amp; [ &quot;$timeout&quot; -gt 0 ] ) ; then                 echo -n &quot;!&quot;                 sleep $timeout         fi     done     localip=`ip route get $ip | head -n1 | sed 's|.*src ||' | cut -d' ' -f1`     tunnel-up $ip $port $localip $localport $peerip $intip $tunnelid     tunnel-check $peerip     tunnel-down $tunnelid $localport     yadelete $username $password $folder     unset ip port myipport done exit 0<\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <i>username<\/i>, <i>password<\/i> \u0438 <i>folder<\/i> \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u0445, \u0430 \u0432\u043e\u0442 <i>intip<\/i> \u2014 \u0440\u0430\u0437\u043d\u044b\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: 10.0.0.1 \u0438 10.0.0.2. \u0412\u0440\u0435\u043c\u044f \u043d\u0430 \u0443\u0437\u043b\u0430\u0445 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">nohup script.sh &amp;<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0449\u0430\u044e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e IPIP-\u0442\u0435\u043d\u043d\u0435\u043b\u044c \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0435\u043d \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0435 \u0448\u0438\u0444\u0440\u0443\u0435\u0442\u0441\u044f, \u043d\u043e \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 IPsec \u043f\u043e <a href=\"http:\/\/abelorus.blogspot.com\/2013\/09\/ipsec-linux-strongswan.html\" rel=\"nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u043e\u043d\u0430 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439.<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u041f\u041a \u0443\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0434\u0435\u043b\u044c \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043b. \u0423\u0434\u043e\u0431\u043d\u043e \u0432 \u043f\u043b\u0430\u043d\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u0438 \u0437\u0430\u0431\u044b\u043b.<\/p>\n<p>  \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0443 \u0412\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0432\u044b\u0441\u043b\u0443\u0448\u0430\u0442\u044c.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/509730\/\"> https:\/\/habr.com\/ru\/post\/509730\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/509730\/\">\u0414\u043e\u0431\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0442\u043e\u043a!<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b (<a href=\"https:\/\/habr.com\/ru\/post\/481034\/\">\u0435\u0449\u0435 \u043e\u0434\u0438\u043d<\/a>) \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 Bash \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u0437\u0430 NAT, \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 UDP hole punching \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u041e\u0421 Ubuntu\/Debian.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-306819","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306819"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306819\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}