{"id":1506,"date":"2013-10-29T10:00:59","date_gmt":"2013-10-29T01:00:59","guid":{"rendered":"https:\/\/www.united-bears.co.jp\/blog\/?p=1506"},"modified":"2013-10-27T18:23:01","modified_gmt":"2013-10-27T09:23:01","slug":"iptables-%e3%81%ae%e8%a8%ad%e5%ae%9a1","status":"publish","type":"post","link":"https:\/\/www.united-bears.co.jp\/blog\/archives\/1506","title":{"rendered":"iptables \u306e\u8a2d\u5b9a(1)"},"content":{"rendered":"<p><a href=\"https:\/\/www.united-bears.co.jp\/blog\/archives\/1487\" target=\"_blank\">\u524d\u56de<\/a>\u306f\u3001SSH \u306e\u8a2d\u5b9a\u3092\u884c\u3063\u305f\u3002\u4eca\u56de\u304b\u30892\u56de\u306b\u308f\u305f\u308a\u3001\u30db\u30b9\u30c8\u3078\u306e\u901a\u4fe1\u3092\u5236\u9650\u3059\u308b\u305f\u3081 iptables \u3068 ip6tables \u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3002<\/p>\n<p><strong>\u5bfe\u8c61<\/strong><br \/>\n\u5185\u90e8\u7528\u30b5\u30fc\u30d0\u30fc<br \/>\n\u5916\u90e8\u7528\u30b5\u30fc\u30d0\u30fc<br \/>\n<strong>OS<\/strong><br \/>\nCentOS release 5.10<\/p>\n<h2>iptables \u3068 TCP Wrapper<\/h2>\n<p>iptables \u306f\u3001Linux Kernel \u306b\u7528\u610f\u3055\u308c\u305f Firewall \u6a5f\u80fd(Netfilter \u30e2\u30b8\u30e5\u30fc\u30eb)\u306e\u5236\u5fa1\u3092\u884c\u3046\u305f\u3081\u306e\u30c4\u30fc\u30eb\u3060\u3002iptables \u306f IPv4 \u306e\u8a2d\u5b9a\u3092\u884c\u3046\u30c4\u30fc\u30eb\u3067\u3001IPv6\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u5834\u5408\u306f ip6tables \u3092\u4f7f\u7528\u3059\u308b\u3002kernel \u30ec\u30d9\u30eb\u3067\u52d5\u4f5c\u3059\u308b\u305f\u3081\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u4f9d\u5b58\u305b\u305a\u901a\u4fe1\u3092\u5236\u5fa1\u3067\u304d\u308b\u3002\u305f\u3068\u3048\u3070\u3001Web \u30b5\u30fc\u30d0\u30fc Apache \u304c TCP 80\u756a\u30dd\u30fc\u30c8\u3067\u5f85\u3061\u53d7\u3051\u3092\u884c\u3063\u3066\u3044\u308b\u3068\u3057\u3088\u3046\u3002iptables \u3067 TCP 80\u756a\u30dd\u30fc\u30c8\u3078\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\u3057\u3066\u3044\u306a\u3051\u308c\u3070\u3001\u30d1\u30b1\u30c3\u30c8\u306f Kernel \u3067\u7834\u68c4\u3055\u308c\u3066 Apache \u306b\u306f\u5c4a\u304b\u306a\u3044\u3002Kernel \u304c\u30d1\u30b1\u30c3\u30c8\u3092\u51e6\u7406\u3059\u308b\u306e\u3067\u3001\u7834\u68c4\u3057\u305f\u5834\u5408\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u898b\u308b\u3068\u901a\u4fe1\u306f\u884c\u308f\u308c\u306a\u304b\u3063\u305f\u3088\u3046\u306b\u898b\u3048\u308b\u3002<\/p>\n<p>\u4e00\u65b9 TCP Wrapper \u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u7d44\u307f\u8fbc\u3080\u30e9\u30a4\u30d6\u30e9\u30ea(libwrap)\u3068\u3057\u3066\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c TCP Wrapper \u3092\u7d44\u307f\u8fbc\u3093\u3067\u3044\u308c\u3070\u3001\u300chosts.deny\u300d\u300chosts.allow\u300d\u306b\u8a18\u8ff0\u3055\u308c\u305f\u30eb\u30fc\u30eb\u306b\u5f93\u3063\u3066\u5236\u5fa1\u3092\u884c\u3046\u3002\u30b5\u30fc\u30d0\u30fc\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c TCP Wrapper \u3092\u7d44\u307f\u8fbc\u3093\u3067\u3044\u306a\u3051\u308c\u3070\u3001\u300chosts.deny\u300d\u3068\u300chosts.allow\u300d\u306b\u30eb\u30fc\u30eb\u3092\u8a18\u8ff0\u3057\u3066\u3082\u610f\u5473\u306f\u306a\u3044\u3002<\/p>\n<p>\u3056\u3063\u304f\u308a\u3001iptables\/ip6tables \u306f\u81ea\u5206\u81ea\u8eab\u306b\u5bfe\u3057\u3066\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u7684\u306a\u5f79\u5272\u3092\u62c5\u3044\u3001TCP Wrapper \u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3054\u3068\u306e\u7d30\u304b\u306a\u5236\u5fa1\u3092\u884c\u3046\u305f\u3081\u306b\u5229\u7528\u3059\u308b\u3068\u8003\u3048\u3066\u3044\u3044\u3060\u308d\u3046\u3002\u4eca\u56de\u306e\u69cb\u6210\u3068\u306f\u5927\u304d\u304f\u7570\u306a\u308b\u304c\u3001Linux \u306e\u30b7\u30b9\u30c6\u30e0\u3092\u30eb\u30fc\u30bf\u30fc\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u5834\u5408\u306f\u3001iptables\/ip6tables \u306e\u8a2d\u5b9a\u304c\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u5bfe\u3057\u3066\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u306e\u5f79\u5272\u3092\u62c5\u3046\u3002<\/p>\n<h2>\u30db\u30b9\u30c8\u3092 iptables \u3067\u5b88\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b<\/h2>\n<p>\u4e0d\u8981\u306a\u30b5\u30fc\u30d3\u30b9\u3092\u505c\u6b62\u3059\u308b\u3068\u3001\u30db\u30b9\u30c8\u4e0a\u3067\u5f85\u3061\u53d7\u3051\u3092\u884c\u3046\u30b5\u30fc\u30d3\u30b9\u306f\u5fc5\u8981\u306a\u3082\u306e\u3060\u3051\u306b\u306a\u308b\u3002iptables \u3067\u5236\u5fa1\u3067\u304d\u308b\u306e\u306f\u3001\u57fa\u672c\u7684\u306b IP \u30a2\u30c9\u30ec\u30b9\u3068\u30dd\u30fc\u30c8\u756a\u53f7\u304c\u30d9\u30fc\u30b9\u3068\u306a\u308b\u305f\u3081\u3001\u300c\u30db\u30b9\u30c8\u4e0a\u3067\u5f85\u3061\u53d7\u3051\u3092\u884c\u3046\u30b5\u30fc\u30d3\u30b9\u300d\u306b\u5bfe\u3057\u3066\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306e\u5f37\u5316\u3092\u884c\u3046\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u3002\u5f93\u3063\u3066\u3001iptables \u306f\u4e0d\u8981\u3068\u3044\u3046\u4eba\u3082\u3044\u308b\u304c\u3001\u8a2d\u5b9a\u30df\u30b9\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3084\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3067\u4e88\u671f\u3057\u306a\u3044\u30dd\u30fc\u30c8\u306e\u5f85\u3061\u53d7\u3051\u304c\u767a\u751f\u3059\u308b\u53ef\u80fd\u6027\u3092\u8003\u3048\u3066 iptables\/ip6tables \u3092\u5229\u7528\u3059\u308b\u3002<\/p>\n<p>\u4e00\u65b9\u3001TCP Wrapper \u306f\u7279\u306b\u8a2d\u5b9a\u3092\u884c\u308f\u306a\u3044\u3002\u4eca\u5f8c\u3001iptables\/ip6tables \u3067\u8a31\u53ef\u3057\u305f\u30b5\u30fc\u30d3\u30b9\u3067\u3001\u8ffd\u52a0\u306e\u5236\u5fa1\u304c\u5fc5\u8981\u306b\u306a\u308c\u3070\u5229\u7528\u3059\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u304c\u3001\u57fa\u672c\u7684\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5229\u7528\u3059\u308b\u4e88\u5b9a\u306a\u306e\u3067\u3001TCP Wrapper \u304c\u7d44\u307f\u8fbc\u307e\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u306f\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u8a2d\u5b9a\u306b\u4f9d\u5b58\u3059\u308b\u3002iptables\/ip6tables \u3068 TCP Wrapper \u3092\u4f75\u7528\u3059\u308b\u3068\u3001\u901a\u4fe1\u304c\u3067\u304d\u306a\u3044\u3068\u304d\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u96e3\u3057\u304f\u306a\u308b\u3053\u3068\u304c\u3042\u308b\u306e\u3067\u3001IP \u30a2\u30c9\u30ec\u30b9\/\u30dd\u30fc\u30c8\u756a\u53f7\u306e\u5236\u5fa1\u306f iptables \u3067\u884c\u3046\u4e88\u5b9a\u3060\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u30b5\u30fc\u30d3\u30b9\u306e\u69cb\u6210\u306b\u306f\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5168\u4f53\u3092\u5b88\u308b\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304c\u306a\u3044\u304c\u3001\u30d5\u30a1\u30a4\u30a2\u30a6\u30a9\u30fc\u30eb\u304c\u5b58\u5728\u3057\u3066\u304a\u308a\u3001DMZ \u4e0a\u306b\u30b5\u30fc\u30d3\u30b9\u3092\u63d0\u4f9b\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u304c\u8907\u6570\u3042\u308b\u5834\u5408\u306f\u3001\u4eca\u56de\u306e\u69cb\u6210\u3068\u540c\u69d8\u306b iptables \u3092\u5229\u7528\u3057\u3066\u901a\u4fe1\u3092\u5236\u9650\u3057\u3066\u304a\u3044\u305f\u65b9\u304c\u3088\u3044\u3060\u308d\u3046\u3002DMZ \u4e0a\u306e\u30b5\u30fc\u30d0\u30fc\u304c\u30af\u30e9\u30c3\u30af\u3055\u308c\u305f\u5834\u5408\u3001iptables \u3067\u5236\u9650\u3092\u3057\u3066\u3044\u306a\u3044\u3068\u6b21\u3005\u306b\u30b5\u30fc\u30d0\u30fc\u304c\u5236\u5727\u3055\u308c\u3066\u3057\u307e\u3046\u53ef\u80fd\u6027\u304c\u3042\u308b\u3002\u5fc5\u8981\u306a\u30dd\u30fc\u30c8\u306f\u958b\u3051\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u306e\u3067\u9632\u5fa1\u306f\u9650\u5b9a\u7684\u3060\u304c\u3001\u5099\u3048\u306f\u539a\u304f\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u3088\u3044\u3002<\/p>\n<h2>iptables \u3068 ip6tables \u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb<\/h2>\n<p>iptables\/ip6tables  \u306f\u3001\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3059\u308b\u5bfe\u8c61\u3092\u793a\u3059\u300c\u30c6\u30fc\u30d6\u30eb\u300d\u3001\u30eb\u30fc\u30eb\u3092\u9069\u7528\u3059\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u3092\u793a\u3059\u300c\u30c1\u30a7\u30a4\u30f3\u300d\u3068\u3001\u30c1\u30a7\u30a4\u30f3\u306b\u8ffd\u52a0\u3059\u308b\u30eb\u30fc\u30eb\u3067\u69cb\u6210\u3055\u308c\u3066\u3044\u308b\u3002<br \/>\n\u30c6\u30fc\u30d6\u30eb\u306f\u3001filter\u3001nat\u3001mangle\u306e3\u3064\u3002filter \u30c6\u30fc\u30d6\u30eb\u306f\u30d1\u30b1\u30c3\u30c8\u306e\u8a31\u53ef\u3084\u7834\u68c4\u3092\u8a2d\u5b9a\u3059\u308b\u3002nat \u30c6\u30fc\u30d6\u30eb\u306f\u3001\u30d1\u30b1\u30c3\u30c8\u306e\u5185\u5bb9\u3092\u5909\u66f4\u3092\u8a2d\u5b9a\u3059\u308b(NAPT\/IP Masquerade \u3092\u4f7f\u7528\u3059\u308b\u969b\u306b\u5229\u7528)\u3002mangle \u30c6\u30fc\u30d6\u30eb\u306f\u3001\u7279\u5225\u306a\u30d1\u30b1\u30c3\u30c8\u5909\u63db\u3092\u8a2d\u5b9a\u3059\u308b\u3002\u4eca\u56de\u5bfe\u8c61\u3068\u3059\u308b\u306e\u306f\u3001filter \u30c6\u30fc\u30d6\u30eb\u3060\u3051\u3060\u3002<br \/>\nfilter \u30c6\u30fc\u30d6\u30eb\u306b\u306f\u3001INPUT\u3001FORWARD\u3001OUTPUT \u306e3\u7a2e\u985e\u306e\u30c1\u30a7\u30a4\u30f3\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u305d\u308c\u305e\u308c\u30db\u30b9\u30c8\u306b\u5165\u3063\u3066\u304f\u308b\u30d1\u30b1\u30c3\u30c8\u3001\u901a\u904e\u3059\u308b\u30d1\u30b1\u30c3\u30c8\u3001\u30db\u30b9\u30c8\u304b\u3089\u9001\u51fa\u3059\u308b\u30d1\u30b1\u30c3\u30c8\u3092\u5236\u5fa1\u3067\u304d\u308b\u3002<\/p>\n<p>iptables \u3082 ip6tables \u3082\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u3064\u3051\u3066\u5b9f\u884c\u3059\u308c\u3070\u3001\u30c6\u30fc\u30d6\u30eb\u3068\u30c1\u30a7\u30a4\u30f3\u3092\u6307\u5b9a\u3057\u3066\u30eb\u30fc\u30eb\u3092\u8ffd\u52a0\u3067\u304d\u308b\u304c\u3001\u30eb\u30fc\u30eb\u3092\u4e00\u304b\u3089\u8003\u3048\u3066\u3044\u304f\u306e\u306f\u5927\u5909\u3060\u3002Cent OS \u306e\u5834\u5408\u3001\u8d77\u52d5\u30b9\u30af\u30ea\u30d7\u30c8\u300c\/etc\/init.d\/iptables\u300d\u306f\u300c\/etc\/sysconfig\/iptables\u300d\u30d5\u30a1\u30a4\u30eb\u3092\u3001\u300c\/etc\/init.d\/ip6tables\u300d\u300c\/etc\/sysconfig\/ip6tables\u300d\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3001\u8d77\u52d5\u6642\u306b iptables\/ip6tables \u306e\u30eb\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b\u3002\u5f93\u3063\u3066\u3001\u3053\u306e2\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u5143\u306b\u30eb\u30fc\u30eb\u3092\u5b9a\u7fa9\u3057\u3066\u3044\u304f\u3002<\/p>\n<p>\u6b21\u56de\u306f\u3001\u3053\u306e2\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u89e3\u8aac\u3057\u3066\u3044\u304f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306f\u3001SSH \u306e\u8a2d\u5b9a\u3092\u884c\u3063\u305f\u3002\u4eca\u56de\u304b\u30892\u56de\u306b\u308f\u305f\u308a\u3001\u30db\u30b9\u30c8\u3078\u306e\u901a\u4fe1\u3092\u5236\u9650\u3059\u308b\u305f\u3081 iptables \u3068 ip6tables \u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3002 \u5bfe\u8c61 \u5185\u90e8\u7528\u30b5\u30fc\u30d0\u30fc \u5916\u90e8\u7528\u30b5\u30fc\u30d0\u30fc OS CentOS release 5. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,30,28],"tags":[],"class_list":["post-1506","post","type-post","status-publish","format-standard","hentry","category-server","category-public_server_default","category-public_server"],"_links":{"self":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/1506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=1506"}],"version-history":[{"count":14,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/1506\/revisions"}],"predecessor-version":[{"id":1520,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/posts\/1506\/revisions\/1520"}],"wp:attachment":[{"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=1506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=1506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.united-bears.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=1506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}