{"id":2063,"date":"2011-12-08T18:10:00","date_gmt":"2011-12-08T16:10:00","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=2063"},"modified":"2023-08-09T16:09:39","modified_gmt":"2023-08-09T13:09:39","slug":"ipfilter-%d1%84%d0%b0%d0%b9%d0%b5%d1%80%d0%b2%d0%be%d0%bb-%d0%b2-solaris","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=2063","title":{"rendered":"[ipfilter] \u0424\u0430\u0439\u0435\u0440\u0432\u043e\u043b \u0432 Solaris"},"content":{"rendered":"<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430 \u0432 <strong>Solaris<\/strong> \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u0430, \u043d\u043e \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043a\u0430\u043a \u043a\u0430\u0436\u0435\u0442\u0441\u044f. \u041e\u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044d\u0442\u0430\u043f\u043e\u0432<\/p>\n<p><em><strong><span style=\"color: #008000;\">\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434<\/span><\/strong><\/em>: <strong>Solaris 11<\/strong><\/p>\n<p><!--more--><strong><span style=\"color: #ff0000;\">1) \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443.<\/span><\/strong><\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0451. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430 (\u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0430\u0432\u0438\u043b):<\/p>\n<p><code># ipfstat -io<br \/>\nempty list for ipfilter(out)<br \/>\nempty list for ipfilter(in)<\/code><\/p>\n<p>\u0424\u0430\u0439\u0435\u0440\u0432\u043e\u043b \u0432 <strong>Solaris<\/strong>, \u043a\u0430\u043a \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <strong>svccfg<\/strong>. \u0418 \u0442\u0430\u043a, \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p><code>#svccfg<br \/>\nsvc:&gt;select network\/ipfilter:default<br \/>\nsvc:\/network\/ipfilter:default&gt;setprop firewall_config_default\/policy = astring: \"custom\"<br \/>\nsvc:\/network\/ipfilter:default&gt;setprop firewall_config_default\/custom_policy_file = astring: \"\/etc\/ipf\/ipf.conf\"<br \/>\nsvc:\/network\/ipfilter:default&gt;exit<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u0442\u043e\u0439 &#8211; <strong>ipfilter<\/strong> \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p><code>pass out quick all<br \/>\npass in quick all<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">2) \u0417\u0430\u043f\u0443\u0441\u043a \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430.<\/span><\/strong><\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430:<\/p>\n<p><code>#svcadm enable svc:\/network\/ipfilter:default<br \/>\n# svcs -a | grep ipfilter<br \/>\nonline 17:55:23 svc:\/network\/ipfilter:default<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">3) \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u043e\u043c<\/span><\/strong><\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0430\u0432\u0438\u043b, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043f\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c:<\/p>\n<p><code># ipfstat -iov<br \/>\n407 49895 pass out quick all<br \/>\n2559 268272 pass in quick all<\/code><\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0431\u0449\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443<\/p>\n<pre>#ipfstat\nbad packets:            in 0    out 0\n IPv6 packets:          in 92 out 52\n input packets:         blocked 0 passed 3651 nomatch 110 counted 0 short 0\noutput packets:         blocked 0 passed 577 nomatch 56 counted 0 short 0\n input packets logged:  blocked 0 passed 1164\noutput packets logged:  blocked 0 passed 179\n packets logged:        input 0 output 0\n log failures:          input 22 output 19\nfragment state(in):     kept 0  lost 0  not fragmented 0\nfragment state(out):    kept 0  lost 0  not fragmented 0\npacket state(in):       kept 0  lost 0\npacket state(out):      kept 0  lost 0\nICMP replies:   0       TCP RSTs sent:  0\nInvalid source(in):     0\nResult cache hits(in):  0       (out):  0\nIN Pullups succeeded:   0       failed: 0\nOUT Pullups succeeded:  0       failed: 0\nFastroute successes:    0       failures:       0\nTCP cksum fails(in):    0       (out):  0\nIPF Ticks:      2434\nPacket log flags set: (0x10000000)\n        packets passed through filter<\/pre>\n<p>\u041e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438:<\/p>\n<p><code>#ipf -z -f\u00a0\/etc\/ipf\/ipf.conf<\/code><\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u043b\u0435\u0442\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 (\u0438 \u0437\u0430\u0442\u0435\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0435):<\/p>\n<p><code>#ipf -F as -f \/etc\/ipf\/ipf.conf<\/code><\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0437 <strong>man\u00a0svc.ipfd<\/strong><\/p>\n<p><em><span style=\"color: #ff6600;\">\u041f\u0435\u0440\u0435\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438<\/span><\/em><\/p>\n<p><code>#svcadm refresh ipfilter<\/code><\/p>\n<p>\u041d\u043e \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0435\u0441\u0441\u0438\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 <strong>NAT&#8217;a<\/strong>, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a (\u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u0435\u0441\u0441\u0438\u0438)<\/p>\n<p><code>#ipnat -f \/etc\/ipf\/ipnat.conf<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">4) ipfilter \u0438 \u0437\u043e\u043d\u044b<\/span><\/strong><\/p>\n<p><strong>ipfilter<\/strong> \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0437\u043e\u043d\u0430\u043c\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0434\u043b\u044f \u0437\u043e\u043d \u0441\u00a0<strong>shared-IP<\/strong> \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u043e\u043d\u0435, \u0430 \u0434\u043b\u044f \u0437\u043e\u043d \u0441\u00a0<strong>exclusive-IP<\/strong> &#8211; \u043c\u043e\u0433\u0443\u0442 \u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u044f\u043c\u043e \u0432 \u0441\u0430\u043c\u0438\u0445 \u0437\u043e\u043d\u0430\u0445.<\/p>\n<p><strong><span style=\"color: #ff0000;\">5) \u041b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/span><\/strong><\/p>\n<p>\u0414\u043b\u044f \u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <strong>ipmon<\/strong>. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0435\u0451 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0442\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0435:<\/p>\n<p><code>#ipmon<br \/>\n09\/12\/2011 12:42:29.977815 2x net0 @0:1 p 10.5.5.133,22 -&gt; 10.5.5.55,49572 PR tcp len 20 196 -AP OUT<br \/>\n09\/12\/2011 12:42:29.978091 net0 @0:1 p 10.5.5.55,49572 -&gt; 10.5.5.133,22 PR tcp len 20 52 -A IN<br \/>\n09\/12\/2011 12:42:29.978261 2x net0 @0:1 p 10.5.5.133,22 -&gt; 10.5.5.55,49572 PR tcp len 20 196 -AP OUT<br \/>\n09\/12\/2011 12:42:29.978507 net0 @0:1 p 10.5.5.55,49572 -&gt; 10.5.5.133,22 PR tcp len 20 52 -A IN<br \/>\n09\/12\/2011 12:42:29.978678 2x net0 @0:1 p 10.5.5.133,22 -&gt; 10.5.5.55,49572 PR tcp len 20 196 -AP OUT<br \/>\n09\/12\/2011 12:42:29.978924 net0 @0:1 p 10.5.5.55,49572 -&gt; 10.5.5.133,22 PR tcp len 20 52 -A IN<br \/>\n09\/12\/2011 12:42:29.979093 2x net0 @0:1 p 10.5.5.133,22 -&gt; 10.5.5.55,49572 PR tcp len 20 196 -AP OUT<br \/>\n09\/12\/2011 12:42:29.979348 net0 @0:1 p 10.5.5.55,49572 -&gt; 10.5.5.133,22 PR tcp len 20 52 -A IN<\/code><\/p>\n<p>\u0423 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u044e\u0447\u0435\u0439, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u0432 \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435.<\/p>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f <strong>ipfilter<\/strong> \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/www.opennet.ru\/base\/sec\/ipf_howto.txt.html\" target=\"_blank\" rel=\"nofollow noopener\">\u044d\u0442\u043e<\/a> \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0444\u0430\u0439\u0435\u0440\u0432\u043e\u043b\u0430 \u0432 Solaris \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u0430, \u043d\u043e \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043a\u0430\u043a \u043a\u0430\u0436\u0435\u0442\u0441\u044f. \u041e\u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044d\u0442\u0430\u043f\u043e\u0432 \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434: Solaris 11<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-2063","post","type-post","status-publish","format-standard","hentry","category-solaris"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2063","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=2063"}],"version-history":[{"count":13,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2063\/revisions"}],"predecessor-version":[{"id":6224,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2063\/revisions\/6224"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}