{"id":258608,"date":"2015-06-03T21:46:02","date_gmt":"2015-06-03T17:46:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=258608"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=258608","title":{"rendered":"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 OpenSWAN IPsec PSK \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c NAT Traversal (NAT-T)"},"content":{"rendered":"<p>     \t\u0414\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u0435\u0441\u044c\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u0432\u043e\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430. \u0427\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c IPsec \u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0431\u044b\u043b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d NAT Traversal (NAT-T). \u0412 \u0441\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043d\u0446\u0430\u0445 \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0432 OpenSWAN. \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u044d\u0442\u0430 \u0442\u0435\u043c\u0430, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b \u043d\u0430 \u0441\u0442\u0435\u043d\u0434\u0435, \u0441\u043e\u0431\u0440\u0430\u0432 \u0432\u043e\u0442 \u0442\u0430\u043a\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/66c\/864\/be2\/66c864be2daa4a7784459780620de01d.jpg\"\/><\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c IPsec \u0442\u0443\u043d\u043d\u0435\u043b\u044c \u043c\u0435\u0436\u0434\u0443 FW1 \u0438 FW2, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c FW1 \u0438\u043c\u0435\u0435\u0442 \u043d\u0430 WAN \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u2014 172.30.0.254 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430 \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430. <\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438 \u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430:<\/p>\n<p>  \u0412\u0430\u0440\u0438\u0430\u043d\u04421:<\/p>\n<table>\n<tr>\n<th>ACTION<\/th>\n<th>SOURCE<\/th>\n<th>DESTINATION<\/th>\n<th>PROTOCOL<\/th>\n<th>PORT<\/th>\n<th>FORWARD<\/th>\n<\/tr>\n<tr>\n<td>DNAT<\/td>\n<td>2.2.2.2<\/td>\n<td>5.5.5.5<\/td>\n<td>50<\/td>\n<td> <\/td>\n<td>172.30.0.254<\/td>\n<\/tr>\n<tr>\n<td>DNAT<\/td>\n<td>2.2.2.2<\/td>\n<td>5.5.5.5<\/td>\n<td>51<\/td>\n<td> <\/td>\n<td>172.30.0.254<\/td>\n<\/tr>\n<tr>\n<td>DNAT<\/td>\n<td>2.2.2.2<\/td>\n<td>5.5.5.5<\/td>\n<td>udp<\/td>\n<td>500<\/td>\n<td>172.30.0.254:500<\/td>\n<\/tr>\n<\/table>\n<p>   \u0422\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0441 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c 2.2.2.2 \u0438 \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 5.5.5.5 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 UDP \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043d\u0430 \u043f\u043e\u0440\u0442 500 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 172.30.0.254(\u044d\u0442\u043e \u043d\u0430\u0448 FW1) \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u043f\u043e\u0440\u0442 500. \u0418 \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c 50 \u0438 51(ESP \u0438 AH \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e).<br \/>  \u042d\u0442\u043e \u043d\u0435 NAT-T, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 IPsec. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u00ab\u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c\u00bb, \u0430 \u043c\u043e\u0436\u0435\u0442 \u0438 \u00ab\u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c\u00bb, \u0438 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439(\u044d\u0442\u043e \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0432\u0435\u0442\u0443\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>  \u0412\u0430\u0440\u0438\u0430\u043d\u04422: NAT Traversal (NAT-T)<\/p>\n<table>\n<tr>\n<th>ACTION<\/th>\n<th>SOURCE<\/th>\n<th>DESTINATION<\/th>\n<th>PROTOCOL<\/th>\n<th>PORT<\/th>\n<th>FORWARD<\/th>\n<\/tr>\n<tr>\n<td>DNAT<\/td>\n<td>2.2.2.2<\/td>\n<td>5.5.5.5<\/td>\n<td>udp<\/td>\n<td>500<\/td>\n<td>172.30.0.254:500<\/td>\n<\/tr>\n<tr>\n<td>DNAT<\/td>\n<td>2.2.2.2<\/td>\n<td>5.5.5.5<\/td>\n<td>udp<\/td>\n<td>4500<\/td>\n<td>172.30.0.254:4500<\/td>\n<\/tr>\n<\/table>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0442\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e UDP \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432.<\/p>\n<p>  \u041a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c OpenSWAN \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0435 \u0440\u0430\u0437, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/habrahabr.ru\/post\/177223\/\">\u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439.<\/p>\n<p>  \u0414\u043b\u044f FW1:<br \/>  <b>\/etc\/ipsec.conf<\/b>  <\/p>\n<pre>nat_traversal=yes protostack=netkey conn connection_to_fw2         type=tunnel         auto=start         authby=secret         pfs=yes         ike=aes256-sha1;modp2048         phase2=esp         phase2alg=aes256-sha1;modp2048         left=172.30.0.254         leftnexthop=172.30.0.1         leftsourceip=192.168.0.1         leftsubnet=192.168.0.0\/24         leftid=@left         right=2.2.2.1         rightsubnets=10.0.0.0\/24         rightid=@right<\/pre>\n<p>  \u0414\u043b\u044f FW2:<br \/>  <b>\/etc\/ipsec.conf<\/b>  <\/p>\n<pre>nat_traversal=yes protostack=netkey conn connection_to_fw1         type=tunnel         auto=start         authby=secret         pfs=yes         ike=aes256-sha1;modp2048         phase2=esp         phase2alg=aes256-sha1;modp2048         right=2.2.2.1         rightid=@right         rightsourceip=10.0.0.1         rightsubnet=10.0.0.0\/24         left=5.5.5.1         leftid=@left         leftsubnet=192.168.0.0\/24         leftnexthop=172.30.0.1<\/pre>\n<p>  \u0441 \u043e\u0431\u043e\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c<b> <u>\u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f<\/u><\/b> \u0437\u0430\u043f\u0438\u0441\u044c \u043a\u043b\u044e\u0447\u0430:  <\/p>\n<pre>@left @right : PSK &quot;123456789&quot;<\/pre>\n<p>  \u041d\u0443 \u0438 \u0432\u0435\u0440\u0441\u0438\u044f Openswan:<br \/>  <i>ipsec &#8212;version<br \/>  Linux Openswan U2.6.37\/K3.2.0-83-generic-pae (netkey)<\/i><\/p>\n<p>  \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c OpenSWAN \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<br \/>  <i>\/etc\/init.d\/ipsec restart<\/i><\/p>\n<p>  <i>root@fw2:~# ifconfig<br \/>  eth0 Link encap:Ethernet HWaddr 00:0c:29:cd:12:76<br \/>   inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0<\/p>\n<p>  root@fw2:~# ping -I eth0 192.168.0.1<br \/>  PING 192.168.0.1 (192.168.0.1) from 10.0.0.1 eth0: 56(84) bytes of data.<br \/>  64 bytes from 192.168.0.1: icmp_req=1 ttl=64 time=0.577 ms<\/i>     \t<\/p>\n<div class=\"clear\"><\/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=\"http:\/\/habrahabr.ru\/post\/259479\/\"> http:\/\/habrahabr.ru\/post\/259479\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u0414\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u0435\u0441\u044c\u043c\u0430 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u0432\u043e\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430. \u0427\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c IPsec \u0442\u0443\u043d\u043d\u0435\u043b\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0431\u044b\u043b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d NAT Traversal (NAT-T). \u0412 \u0441\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u043e\u0432 \u043d\u0430 \u043a\u043e\u043d\u0446\u0430\u0445 \u0442\u0443\u043d\u043d\u0435\u043b\u044f \u0432 OpenSWAN. \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u044d\u0442\u0430 \u0442\u0435\u043c\u0430, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.  <\/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-258608","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258608","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=258608"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258608\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}