{"id":177767,"date":"2013-04-24T06:48:03","date_gmt":"2013-04-24T02:48:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=177767"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=177767","title":{"rendered":"<span class=\"post_title\">\u0411\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0430 2-\u0445 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u043d\u0430 FreeBSD \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c PF + Squid<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u0414\u043e\u0431\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0442\u043e\u043a, \u0445\u0430\u0431\u0440\u043e\u0436\u0438\u0442\u0435\u043b\u0438! <\/h4>\n<p>  \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0445\u043e\u0442\u044f \u043c\u043e\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043c\u044b\u0441\u043b\u044f\u043c\u0438 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0430 \u043c\u043d\u0435 \u0438\u043d\u0432\u0430\u0439\u0442, \u043e\u0434\u043d\u0430\u043a\u043e \u043a\u0430\u0440\u043c\u0430 \u0443\u0448\u043b\u0430 \u0432 \u043c\u0438\u043d\u0443\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0440\u0435\u0430\u0431\u0438\u043b\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f.   <\/p>\n<h6>\u0418\u0442\u0430\u043a, \u043e \u0437\u0430\u0434\u0430\u0447\u0435: \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043a\u0430\u043d\u0430\u043b\u0430 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0448\u043b\u044e\u0437 \u043d\u0430 FreeBSD <\/h6>\n<p>  <code>gate# uname -a FreeBSD gate 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Thu Nov  1 06:48:52 OMST 2012     root@gate:\/usr\/obj\/usr\/src\/sys\/GATE  amd64<\/code><br \/>  \u041d\u0435 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c, \u043d\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0438\u0431\u043a\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043f\u043e \u043a\u0430\u043d\u0430\u043b\u0430\u043c \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u043c\u0438\u044e \u043e\u0442 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430. <br \/>  \u041a\u0430\u043d\u0430\u043b \u21161: \u0431\u0435\u0437\u043b\u0438\u043c\u0438\u0442\u043a\u0430, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c 7 \u041c\u0431, \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 ip-\u0430\u0434\u0440\u0435\u0441<br \/>  \u041a\u0430\u043d\u0430\u043b \u21162: \u0431\u0435\u0437\u043b\u0438\u043c\u0438\u0442\u043a\u0430, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e 60\u041c\u0431, \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 ip-\u0430\u0434\u0440\u0435\u0441.<br \/>  \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0431\u044b\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0448\u043b\u044e\u0437\u044b, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e DMZ \u043d\u0430 \u00ab\u043b\u043e\u0432\u0443\u0448\u043a\u0438\u00bb \u0434\u043b\u044f \u0445\u0430\u043a\u0435\u0440\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 PF \u0438 SQUID \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h6>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u0438\u044f \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438<\/h6>\n<p>  \u0412\u0441\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root. (\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0445\u043e\u0441\u0442\u0443 \u043b\u044e\u0431\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0437\u0430\u0442\u0435\u043c <code>su<\/code>, \u043f\u0430\u0440\u043e\u043b\u044c root). <\/p>\n<p>  1. \u041e\u043f\u0446\u0438\u0438 \u044f\u0434\u0440\u0430 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f PF: <br \/>  \u0415\u0441\u043b\u0438 \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 PF, \u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u043d\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c<\/p>\n<p>  <code>cd \/sys\/amd64\/conf<\/code><br \/>  <code>cp GENERIC GATE<\/code><br \/>  <code>ee GATE<\/code><\/p>\n<p>  <code>device          pf<\/code><br \/>  <code>device          pflog<\/code><\/p>\n<p>  <code>options ALTQ<\/code><br \/>  <code>options ALTQ_CBQ<\/code><br \/>  <code>options ALTQ_RED<\/code><br \/>  <code>options ALTQ_RIO<\/code><br \/>  <code>options ALTQ_HFSC<\/code><br \/>  <code>options ALTQ_PRIQ<\/code><br \/>  <code>options ALTQ_NOPCC<\/code><\/p>\n<p>  2. \u0441\u0431\u043e\u0440\u043a\u0430 \u044f\u0434\u0440\u0430<br \/>  <code>make kernel KERNCONF=GATE<\/code><\/p>\n<p>  3. \u0412 \u0448\u043b\u044e\u0437 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b 2 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043a\u0430\u0440\u0442\u044b, \u043e\u0434\u043d\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432 \u043c\u0430\u0442\u0435\u0440\u0438\u043d\u0441\u043a\u0443\u044e \u043f\u043b\u0430\u0442\u0443: <br \/>  <code>re0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500         options=389b&lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC&gt;         inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255 re1: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500         options=389b&lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC&gt;         inet 192.168.63.26 netmask 0xfffffff8 broadcast 192.168.63.31 nfe0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500         options=82008&lt;VLAN_MTU,WOL_MAGIC,LINKSTATE&gt;         inet 10.1.1.30 netmask 0xffffff00 broadcast 10.1.1.255 <\/code><br \/>  re0 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u21161, re1 \u2014 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u21162. \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 nfe0 (\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 ip \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438 \u043c\u0430\u0441\u043e\u043a \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438, \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c). \u0418 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u044b vlan \u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u0440\u0430\u0441\u043a\u0438\u0434\u044b\u0432\u0430\u044e \u043f\u043e \u043d\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 ip \u0432\u0438\u0434\u0435\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0442\u0434\u0435\u043b\u044b \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438. <\/p>\n<p>  4. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 rc.conf<br \/>  <code>ee \/etc\/rc.conf<\/code><br \/>  <code>pf_enable=&quot;YES&quot;<\/code><br \/>  <code>pf_rules=&quot;\/etc\/pf.conf&quot;<\/code><br \/>  <code>squid_enable=&quot;YES&quot;<\/code><br \/>  <code>reboot<\/code><\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \/etc\/pf.conf. <\/p>\n<p>  5. \u041b\u0438\u0441\u0442\u0438\u043d\u0433 pf.conf.<\/p>\n<p>  <code>cat pf.conf<\/code><br \/>  #\u0417\u0430\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0433\u0434\u0435 int_if \u2014 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, ext_if \u2014 \u0432\u043d\u0435\u0448\u043d\u0438\u0435. <br \/>  int_if=\u00abnfe0\u00bb<br \/>  ext_if=\u00abre1\u00bb<br \/>  ext_if2=\u00abre0\u00bb<br \/>  int_net=\u00ab10.1.1.0\/24\u00bb<br \/>  freeBSD=\u00ab10.1.1.30\u00bb<br \/>  icmp_types=&quot;{ echoreq, unreach}&quot;<br \/>  http=\u00ab80\u00bb<br \/>  https=\u00ab443\u00bb<br \/>  ssh=\u00ab22\u00bb<\/p>\n<p>  #\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0448\u043b\u044e\u0437\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432. <br \/>  gw1=\u00ab192.168.63.25\u00bb<br \/>  gw2=\u00ab192.168.1.1\u00bb<\/p>\n<p>  #\u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0434\u0442\u0438 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0432\u0432\u043e\u0434\u0438\u043c \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0444\u0438\u043a\u0430 \u0432 \u043e\u0431\u0445\u043e\u0434 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438. <br \/>  #\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043b\u0438\u0435\u043d\u0442-\u0431\u0430\u043d\u043a\u0438 \u0438\u043b\u0438 \u0442\u0435\u043d\u0434\u0435\u0440\u043d\u044b\u0435 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b \u043a \u0441\u043c\u0435\u043d\u0435 ip-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0435. <br \/>  to_ertel=&quot;{10.1.1.42, 10.1.1.33, 10.1.1.4, 10.1.1.12, 10.1.1.5, 10.1.1.48, 10.1.1.25, 10.1.1.3, 10.1.1.243, 10.1.1.5 }&quot;<br \/>  to_trans=&quot;{ 10.1.1.27, 10.1.1.2, 10.1.1.181, 10.1.1.46, 10.1.1.39, 10.1.1.27, 10.1.1.31, 10.1.1.113 }&quot;<\/p>\n<p>  #\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u0430 \u2014 \u0432\u0441\u0435\u0445 \u0438\u0437 \u0432\u043d\u0435 \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c, <br \/>  set block-policy drop<br \/>  set skip on lo<br \/>  #\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u0435\u0440\u0435\u0434 \u0438\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439. <br \/>  scrub in all<\/p>\n<p>  #\u041d\u0430\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0432\u0445\u043e\u0434<br \/>  nat on $ext_if inet from any to any -&gt; ($ext_if)<br \/>  #\u041d\u0430\u0442 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0432\u0445\u043e\u0434<br \/>  nat on $ext_if2 inet from any to any -&gt; ($ext_if2)<br \/>  #\u041f\u0440\u043e\u0431\u0440\u043e\u0441 \u043d\u0430 SQUID<br \/>  rdr on $int_if inet proto tcp from any to any port www -&gt; 127.0.0.1 port 3128<\/p>\n<p>  block in from any to any<br \/>  block out from any to any<\/p>\n<p>  #\u0410\u043d\u0442\u0438\u0441\u043f\u0443\u0444\u0438\u043d\u0433<br \/>  antispoof quick for $int_if inet<\/p>\n<p>  # \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435<br \/>  pass out on $int_if from any to $int_net<\/p>\n<p>  #\u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u0431\u0435\u0437 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 (\u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u0430\u0434\u0440\u0435\u0441\u043e\u0432)<br \/>  pass in quick on $int_if route-to ($ext_if2 $gw2) from $to_trans to !$int_net keep state<br \/>  pass in quick on $int_if route-to ($ext_if $gw1) from $to_ertel to !$int_net keep state<\/p>\n<p>  # \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c (quick) \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u0448\u043b\u044e\u0437\u0443<br \/>  pass in quick on $int_if from $int_net to $int_if<br \/>  pass in quick on $int_if route-to { ($ext_if $gw1), ($ext_if2 $gw2)} round-robin proto tcp from $int_net to any flags S\/SA keep state<\/p>\n<p>  # \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e icmp \u0438 udp \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0438\u0434\u0443\u0449\u0435\u0433\u043e \u0438\u0437 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0441\u0435\u0442\u0438<br \/>  pass in on $int_if route-to { ($ext_if $gw1), ($ext_if2 $gw2) } round-robin proto { udp, icmp } from $int_net to any keep state<\/p>\n<p>  # \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u00ab\u0432\u044b\u043f\u0443\u0441\u043a\u0430\u044e\u0448\u0438\u0435\u00bb \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043d\u0430 \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435<br \/>  pass out on $ext_if proto tcp from any to any flags S\/SA modulate state<br \/>  pass out on $ext_if proto { udp, icmp } from any to any keep state<br \/>  pass out on $ext_if2 proto tcp from any to any flags S\/SA modulate state<br \/>  pass out on $ext_if2 proto { udp, icmp } from any to any keep state<\/p>\n<p>  # \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438\u0434\u0443\u0449\u0438\u0445 \u0441 \u043b\u044e\u0431\u043e\u0433\u043e IP \u043d\u0430 $ext_if1 \u0447\u0435\u0440\u0435\u0437 $ext_gw1 \u0438<br \/>  # \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438\u0434\u0443\u0449\u0438\u0445 \u043d\u0430 $ext_if2 \u0447\u0435\u0440\u0435\u0437 $ext_gw2<br \/>  pass out on $ext_if route-to ($ext_if2 $gw2) from $ext_if2 to any<br \/>  pass out on $ext_if2 route-to ($ext_if $gw1) from $ext_if to any<\/p>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u043e\u043b\u043e\u0441 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u043d\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e, \u0434\u0443\u043c\u0430\u044e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433. <\/p>\n<p>  \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u043d\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0447\u0442\u043e-\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432, \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442. <br \/>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b: pf.conf.ertelecom \u0438 pf.conf.trans, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c, \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430: <br \/>  <code>#pass in on $int_if route-to { ($ext_if $gw1), ($ext_if2 $gw2) } round-robin proto { udp, icmp } from $int_net to any keep state<\/code><br \/>  \u0438\u0437 \u043d\u0438\u0445 \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u0430.<br \/>  \u0421\u043a\u0440\u0438\u043f\u0442\u044b \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a: <\/p>\n<p>  cat er_conn.sh<br \/>  #!\/bin\/sh<\/p>\n<p>  GW1=\u00ab192.168.63.25\u00bb<br \/>  if1=\u00ab192.168.63.26\u00bb<\/p>\n<p>  #\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u043b<br \/>  \/sbin\/pfctl -d<br \/>  #\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u043b \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u21162<br \/>  \/sbin\/pfctl -e -f \/etc\/pf.conf.dom<br \/>  #\u0423\u0431\u0438\u0432\u0430\u0435\u043c \u0448\u043b\u044e\u0437 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<br \/>  \/sbin\/route del default<br \/>  #\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0448\u043b\u044e\u0437 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u21162<br \/>  \/sbin\/route add default $GW1<\/p>\n<p>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u044d\u0442\u043e\u043c\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u21161 \u0438 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0434\u0440\u0435\u0441 \u0448\u043b\u044e\u0437\u0430 \u0438 \u0444\u0430\u0439\u043b \u043f\u0440\u0430\u0432\u0438\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 pf. <br \/>  \u0412 cron \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u0436\u0434\u044b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e (\u043d\u0430 \u0432\u044b\u0431\u043e\u0440) \u043c\u0438\u043d\u0443\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430 \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0448\u043b\u044e\u0437\u0430: <br \/>  <code>ping -S &lt;ip \u0430\u0434\u0440\u0435\u0441 \u0448\u043b\u044e\u0437\u0430 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430&gt; &lt;\u043d\u0430\u0448 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 ip-\u0430\u0434\u0440\u0435\u0441&gt;. <\/code><br \/>  \u0415\u0441\u043b\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435\u0442, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0436\u0438\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430. <\/p>\n<p>  \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 SQUID, \u0442\u043e \u0442\u0430\u043c \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u043e. \u0421\u043e\u0431\u0440\u0430\u043b squid 3 \u0438\u0437 \u043f\u043e\u0440\u0442\u043e\u0432, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043d\u0438\u0447\u0435\u0433\u043e, \u043a\u0440\u043e\u043c\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 transparent, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438. \u041f\u0440\u0438\u0432\u043e\u0436\u0443 \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b: <br \/>  <code> cat squid.conf  http_port 127.0.0.1:3128 transparent icp_port 0 hierarchy_stoplist cgi-bin ? acl QUERY urlpath_regex cgi-bin \\? no_cache deny QUERY cache_mem 256 MB maximum_object_size 8092 KB maximum_object_size_in_memory 512 KB cache_dir ufs \/bkp\/var\/squid\/cache 2048 64 256 cache_access_log \/bkp\/var\/squid\/access.log cache_log \/bkp\/var\/squid\/cache.log cache_store_log \/bkp\/var\/squid\/store.log cache_mgr root@xxx.ru cache_effective_user squid cache_effective_group squid visible_hostname gate coredump_dir \/bkp\/var\/squid\/cache pid_filename \/var\/run\/squid\/squid.pid  acl our_networks src 10.1.1.0\/24 http_access allow our_networks   <\/code><\/p>\n<p>  \u0412\u043e\u0442 \u0441 \u044d\u0442\u0438\u043c \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0443\u0436\u0435 \u043e\u043a\u043e\u043b\u043e \u0434\u0432\u0443\u0445 \u043b\u0435\u0442, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u043b\u0435\u0442\u0430\u0435\u0442, \u0448\u043b\u044e\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0440\u0438\u0445\u043e\u0442\u044f\u043c \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u043a\u043e\u0432, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0437\u0430\u0431\u044b\u043b\u0438, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442. <br \/>  \u0422\u0440\u0430\u0444\u0438\u043a \u0441\u0447\u0438\u0442\u0430\u044e \u0441\u043f\u0438\u0440\u0442\u043e\u043c (cnupm), \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0435\u0433\u043e \u043b\u043e\u0433\u043e\u0432 \u0432 \u0431\u0430\u0437\u0443 MySQL.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/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=\"http:\/\/habrahabr.ru\/post\/177767\/\"> http:\/\/habrahabr.ru\/post\/177767\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u0414\u043e\u0431\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0442\u043e\u043a, \u0445\u0430\u0431\u0440\u043e\u0436\u0438\u0442\u0435\u043b\u0438! <\/h4>\n<p>  \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0445\u043e\u0442\u044f \u043c\u043e\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043c\u044b\u0441\u043b\u044f\u043c\u0438 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0430 \u043c\u043d\u0435 \u0438\u043d\u0432\u0430\u0439\u0442, \u043e\u0434\u043d\u0430\u043a\u043e \u043a\u0430\u0440\u043c\u0430 \u0443\u0448\u043b\u0430 \u0432 \u043c\u0438\u043d\u0443\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0440\u0435\u0430\u0431\u0438\u043b\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f.   <\/p>\n<h6>\u0418\u0442\u0430\u043a, \u043e \u0437\u0430\u0434\u0430\u0447\u0435: \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043a\u0430\u043d\u0430\u043b\u0430 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0448\u043b\u044e\u0437 \u043d\u0430 FreeBSD <\/h6>\n<p>  <code>gate# uname -a FreeBSD gate 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Thu Nov  1 06:48:52 OMST 2012     root@gate:\/usr\/obj\/usr\/src\/sys\/GATE  amd64<\/code><br \/>  \u041d\u0435 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c, \u043d\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0438\u0431\u043a\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441 \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u043f\u043e \u043a\u0430\u043d\u0430\u043b\u0430\u043c \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u043c\u0438\u044e \u043e\u0442 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430. <br \/>  \u041a\u0430\u043d\u0430\u043b \u21161: \u0431\u0435\u0437\u043b\u0438\u043c\u0438\u0442\u043a\u0430, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c 7 \u041c\u0431, \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 ip-\u0430\u0434\u0440\u0435\u0441<br \/>  \u041a\u0430\u043d\u0430\u043b \u21162: \u0431\u0435\u0437\u043b\u0438\u043c\u0438\u0442\u043a\u0430, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e 60\u041c\u0431, \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 ip-\u0430\u0434\u0440\u0435\u0441.<br \/>  \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0431\u044b\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b \u0448\u043b\u044e\u0437\u044b, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e DMZ \u043d\u0430 \u00ab\u043b\u043e\u0432\u0443\u0448\u043a\u0438\u00bb \u0434\u043b\u044f \u0445\u0430\u043a\u0435\u0440\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 PF \u0438 SQUID \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b<\/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-177767","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177767","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=177767"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177767\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}