{"id":1263,"date":"2011-05-27T14:33:42","date_gmt":"2011-05-27T11:33:42","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=1263"},"modified":"2021-03-09T09:43:13","modified_gmt":"2021-03-09T07:43:13","slug":"%d0%bd%d0%b5%d1%81%d0%ba%d0%be%d0%bb%d1%8c%d0%ba%d0%be-ppp-%d1%81%d0%b5%d1%81%d1%81%d0%b8%d0%b9-%d0%b8-reply-to-%d0%b8%d0%b7-pf","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=1263","title":{"rendered":"[pf] \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e ppp \u0441\u0435\u0441\u0441\u0438\u0439 \u0438 reply-to \u0438\u0437 PF"},"content":{"rendered":"<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 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e 2 \u043a\u0430\u043d\u0430\u043b\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <strong>ppp<\/strong> \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <strong>USB<\/strong> \u043c\u043e\u0434\u0435\u043c\u043e\u0432.<\/p>\n<p>\u041e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043d\u044e\u0430\u043d\u0441 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u043f\u0435\u0440\u0451\u0434 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c <strong>IP<\/strong>-\u0430\u0434\u0440\u0435\u0441\u0430 \u0448\u043b\u044e\u0437\u043e\u0432 \u0434\u043b\u044f <strong>ppp<\/strong>-\u0441\u0435\u0441\u0441\u0438\u0439. \u041d\u043e \u044d\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0435.<\/p>\n<p><strong><em><span style=\"color: #008000;\">\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434:<\/span><\/em><\/strong> <strong>FreeBSD 8.2 i386, USB<\/strong> \u043c\u043e\u0434\u0435\u043c\u044b <strong>Novatel U720, AnyData ADU-500<\/strong>.<\/p>\n<p><!--more--><strong><span style=\"color: #ff0000;\">1) \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043c\u043e\u0434\u0435\u043c\u043e\u0432.<\/span><\/strong><\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u043e\u0434\u0435\u043c\u0430\u043c\u0438, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 <strong>u3g<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u044f\u0434\u0440\u0435 <strong>GENERIC<\/strong>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043c\u043e\u0432, \u043e\u043d\u0438 \u0443 \u0432\u0430\u0441 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435:<\/p>\n<p><code># usbconfig | grep CDMA<br \/>\nugen0.2: &lt;AnyDATA CDMA Products AnyDATA Corporation&gt; at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON<br \/>\nugen1.2: &lt;Novatel Wireless CDMA Novatel Wireless Inc.&gt; at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0432\u0438\u0434\u044f\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043c\u044b, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0447\u0435\u0440\u0435\u0437 \u041f\u043e\u0438\u0441\u043a \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u043c\u0443 \u0441\u043b\u043e\u0432\u0443 <strong>USB<\/strong>.<\/p>\n<p><strong><span style=\"color: #ff0000;\">2) \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 ppp.<\/span><\/strong><\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 <strong>ppp.conf<\/strong> (\u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u0440\u043e\u043c\u0435<strong> itc<\/strong> \u0438 <strong>mts<\/strong> \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 \u043e\u0442\u0441\u0442\u0443\u043f\u043e\u0432):<\/p>\n<p><code>itc:<br \/>\nident user-ppp VERSION (built COMPILATIONDATE)<br \/>\nset log PHase Chat LCP IPCP CCP tun command<br \/>\nset device \/dev\/cuaU4.0<br \/>\nset phone \"#777\"<br \/>\nset dial \"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\\"\\\" AT OK-AT-OK ATE1Q0s7=60 OK \\\\dATDT\\\\T TIMEOUT 40 CONNECT\"<br \/>\nset login<br \/>\nset timeout 0<br \/>\nset authname \"IT\"<br \/>\nset authkey \"IT\"<br \/>\nadd default HISADDR<br \/>\ndisable ipv6cp<\/code><\/p>\n<p><code>mts:<br \/>\nset log Phase Chat LCP IPCP CCP tun command<br \/>\nident user-ppp VERSION (built COMPILATIONDATE)<br \/>\nset device \/dev\/cuaU0.0<br \/>\nset speed 115200<br \/>\nset ctsrts off<br \/>\nset phone \"#777\"<br \/>\nset dial \"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\\"\\\" AT OK-AT-OK ATE1Q0 OK \\\\dATD\\\\T TIMEOUT 40 CONNECT\"<br \/>\nset login<br \/>\nset timeout 0<br \/>\nset authname \"mobile\"<br \/>\nset authkey \"internet\"<br \/>\nset ifaddr 0.0.0.0\/0 0.0.0.0\/0 0.0.0.0\/0<br \/>\n#&nbsp; add default HISADDR<br \/>\nset ipcpretries 10 5<br \/>\ndisable ipv6cp<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0444\u0430\u0439\u043b\u0443<strong> ppp.linkup<\/strong>. \u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u0438\/\u043e\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u0438<strong> ppp<\/strong>-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0424\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 <strong>ppp.conf<\/strong>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 (<em><strong><span style=\"color: #ff0000;\">\u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0441 ! \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u043e\u0442\u0441\u0442\u0443\u043f\u044b<\/span><\/strong><\/em>):<\/p>\n<p><code>itc:<br \/>\n!bg \/etc\/pf-anchor.sh itc INTERFACE HISADDR<br \/>\n<\/code><br \/>\n<code>mts:<br \/>\n!bg \/etc\/pf-anchor.sh mts INTERFACE HISADDR<\/code><\/p>\n<p>\u041a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438.<\/p>\n<p>\u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b<strong> ppp.linkdown<\/strong>.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/span><\/strong><\/em><\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 <strong>set device<\/strong>. \u0423 \u0432\u0430\u0441 \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0438 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u043c\u0443 \u043c\u043e\u0434\u0435\u043c\u0443 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043a\u0430\u043a\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u042f \u043d\u0430\u0448\u0451\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c.<\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 <strong>\/etc\/rc.conf<\/strong> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u0435\u043c\u043e\u043d\u0430 <strong>ppp<\/strong>. \u041e\u043d\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a:<\/p>\n<p><code>ppp_enable=\"YES\"<br \/>\nppp_mode=\"ddial\"<br \/>\nppp_nat=\"NO\"<br \/>\nppp_profile=\"itc mts\"<br \/>\nppp_user=\"root\"<\/code><\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/span><\/strong><\/em><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u044e\u0430\u043d\u0441\u044b \u0432 \u0442\u043e\u043c \u043f\u043b\u0430\u043d\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c &#8220;\u043f\u0440\u043e\u0444\u0438\u043b\u0438&#8221; \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0412 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e 1 \u043c\u043e\u0434\u0435\u043c.<\/p>\n<p><strong><span style=\"color: #ff0000;\">3) \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 PF.<\/span><\/strong><\/p>\n<p>\u0424\u0430\u0439\u043b \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 <strong>\/etc\/pf.rules<\/strong> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 (\u044f \u043f\u043e\u043a\u0430 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442):<\/p>\n<p><code>nat-anchor itc<br \/>\nnat-anchor mts<\/code><\/p>\n<p><code>anchor itc<br \/>\nanchor mts<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044f\u043a\u043e\u0440\u044f (<strong>\/etc\/pf-anchor.conf<\/strong>):<\/p>\n<p><code>nat on $ext_if from 10.1.0.0\/24 to any -&gt; ($ext_if)<br \/>\npass in on $ext_if reply-to ($ext_if $gw) from any to ($ext_if) keep state<\/code><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e: \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f <strong>NAT&#8217;a<\/strong> \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0447\u0442\u043e \u0431\u044b \u0448\u043b\u0438 \u0442\u0443\u0434\u0430, \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u0440\u0438\u0448\u043b\u0438, \u0430 \u043d\u0435 \u0447\u0435\u0440\u0435\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041d\u0443 \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f &#8211; \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b (<strong>\/etc\/pf-anchor.sh<\/strong>):<\/p>\n<p><code>#!\/bin\/sh<\/code><\/p>\n<p><code>anchor=$1<br \/>\next_if=$2<br \/>\ngw=$3<br \/>\n<\/code><br \/>\n<code>pf_config=\"\/etc\/pf-anchor.conf\"<br \/>\npf=\"\/sbin\/pfctl\"<\/code><\/p>\n<p><code>$pf -a $anchor -Fa<br \/>\n$pf -a $anchor -D ext_if=$ext_if -D gw=$gw -f $pf_config<\/code><\/p>\n<h1><span style=\"text-decoration: underline;\"><em><strong><span style=\"color: #ff0000; text-decoration: underline;\">\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c!<\/span><\/strong><\/em><\/span><\/h1>\n<p>\u041e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0447\u0435\u0433\u043e, \u043a\u0440\u043e\u043c\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 &#8211; \u0442\u0443\u0442 \u043c\u044b \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u044f\u043a\u043e\u0440\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0430\u044f \u0441\u0435\u0441\u0441\u0438\u044f <strong>ppp<\/strong> \u0438\u0445 \u0432\u044b\u0437\u0432\u0430\u043b\u0430 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/span><\/strong><\/em><\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u043a\u043e\u0440\u0435\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p><code>pass in on $int2 reply-to ($int2 $int2:peer) from any to ($int2) keep state<br \/>\npass in on $int1 reply-to ($int1 $int1:peer) from any to ($int1) keep state<br \/>\n<\/code><\/p>\n<p>\u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043f\u043e\u0434\u043d\u0438\u043c\u0443\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b <strong>tun0\/tun1<\/strong>.<\/p>\n<p><strong><span style=\"color: #ff0000;\">4) \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b.<\/span><\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0441\u0435\u0441\u0441\u0438\u0439 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0435:<\/p>\n<p><code>srv-test# ifconfig tun0<br \/>\ntun0: flags=8051&lt;UP,POINTOPOINT,RUNNING,MULTICAST&gt; metric 0 mtu 1500<br \/>\noptions=80000&lt;LINKSTATE&gt;<br \/>\ninet 195.128.XX.XX --&gt; 195.128.XX.XX netmask 0xffffffff<br \/>\nOpened by PID 456<br \/>\nsrv-test# ifconfig tun1<br \/>\ntun1: flags=8051&lt;UP,POINTOPOINT,RUNNING,MULTICAST&gt; metric 0 mtu 1500<br \/>\noptions=80000&lt;LINKSTATE&gt;<br \/>\ninet 77.52.YY.YY --&gt; 80.255.YY.YY netmask 0xffffffff<br \/>\nOpened by PID 465<\/code><\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p><code>srv-test# pfctl -a '*' -sr<br \/>\nanchor \"itc\" all {<br \/>\npass in on tun0 reply-to (tun0 195.128.XX.XX) inet from any to (tun0) flags S\/SA keep state<br \/>\n}<br \/>\nanchor \"mts\" all {<br \/>\npass in on tun1 reply-to (tun1 80.255.YY.YY) inet from any to (tun1) flags S\/SA keep state<br \/>\n}<\/code><\/p>\n<p>\u0417\u0430\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e <strong>pf -sr<\/strong>, \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u0431\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p><code>anchor \"itc\" all<br \/>\nanchor \"mts\" all<\/code><\/p>\n<p>\u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u0430\u0432\u0438\u043b \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438:<\/p>\n<p><code>srv-test# pfctl -a 'itc' -sn<br \/>\nnat on tun0 inet from 10.1.0.0\/24 to any -&gt; (tun0) round-robin<br \/>\nsrv-test# pfctl -a 'mts' -sn<br \/>\nnat on tun1 inet from 10.1.0.0\/24 to any -&gt; (tun1) round-robin<\/code><\/p>\n<p><span style=\"color: #ff0000;\"><strong>5) \u041d\u044e\u0430\u043d\u0441\u044b<\/strong><\/span><\/p>\n<blockquote><p><span style=\"color: #993366;\">\u0414\u043b\u044f UDP \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043b\u0443\u0448\u0430\u0435\u0442 &#8220;\u043b\u044e\u0431\u043e\u0439 IP&#8221; (*:port), \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c,<\/span><br \/>\n<span style=\"color: #993366;\">\u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u043d\u043d\u043e IP \u043f\u0440\u0438\u0448\u0435\u043b \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0441 \u043d\u0435\u0433\u043e.<\/span><\/p>\n<p><span style=\"color: #993366;\">bind (\u0438 ntpd \u0438 \u0434\u0440\u0443\u0433\u0438\u0435) \u043e\u0431\u0445\u043e\u0434\u044f\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0441\u043e\u043a\u0435\u0442\u0443<\/span><br \/>\n<span style=\"color: #993366;\">\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e IP \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043e\u043a\u0435\u0442\u044b.<\/span><\/p><\/blockquote>\n<p>\u0427\u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442? \u0410 \u0442\u043e, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u0435 \u043d\u0430 <strong>*<\/strong> \u0434\u0435\u043c\u043e\u043d <strong>openvpn&#8217;a<\/strong>, \u0442\u043e \u043e\u0442\u0432\u0435\u0442\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0443\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 <strong><span style=\"color: #ff0000;\">\u041d\u0415 <\/span>default route<\/strong>. \u041a\u0430\u043a \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u044c \u0438\u0437 \u0442\u0430\u043a\u043e\u0433\u043e? \u0412\u0435\u0448\u0430\u0442\u044c \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0434\u0435\u043c\u043e\u043d\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <strong><span style=\"color: #ff0000;\">\u041d\u0415<\/span> <\/strong>\u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 <strong>default route<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<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 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e 2 \u043a\u0430\u043d\u0430\u043b\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 ppp \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 USB \u043c\u043e\u0434\u0435\u043c\u043e\u0432. \u041e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043d\u044e\u0430\u043d\u0441 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u043f\u0435\u0440\u0451\u0434 \u043d\u0435 \u0437\u043d\u0430\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0448\u043b\u044e\u0437\u043e\u0432 \u0434\u043b\u044f ppp-\u0441\u0435\u0441\u0441\u0438\u0439. \u041d\u043e \u044d\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043d\u043e\u0435. \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434: FreeBSD 8.2 i386, USB \u043c\u043e\u0434\u0435\u043c\u044b Novatel U720, AnyData ADU-500.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,12],"tags":[],"class_list":["post-1263","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-routers"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/1263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1263"}],"version-history":[{"count":18,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions"}],"predecessor-version":[{"id":5706,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions\/5706"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}