{"id":382,"date":"2026-04-16T21:24:02","date_gmt":"2026-04-16T12:24:02","guid":{"rendered":"https:\/\/falcon21.space\/kazuya\/work\/?page_id=382"},"modified":"2026-04-16T21:25:34","modified_gmt":"2026-04-16T12:25:34","slug":"iptables%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89","status":"publish","type":"page","link":"https:\/\/falcon21.space\/kazuya\/work\/?page_id=382","title":{"rendered":"iptables\u30b3\u30de\u30f3\u30c9"},"content":{"rendered":"\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u73fe\u5728\u306e\u8a2d\u5b9a\u78ba\u8a8d<\/h1>\n\n\n\n<p>iptables -nL &#8211;line-numbers<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">80\u756a\u30dd\u30fc\u30c8\u3078\u306e\u901a\u4fe1\u3092\u62d2\u5426<\/h1>\n\n\n\n<p>iptables -A -s &lt;\u9001\u4fe1\u5143IP&gt; -d &lt;\u5b9b\u5148IP&gt; -p &lt;\u30d7\u30ed\u30c8\u30b3\u30eb&gt; &#8211;dport &lt;\u5b9b\u5148\u30dd\u30fc\u30c8&gt; -j<br>iptables -A INPUT -s 192.168.0.1 -p tcp &#8211;dport 80 -j DROP<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u884c\u756a\u53f7\u306b\u3088\u308b\u30eb\u30fc\u30eb\u306e\u524a\u9664<\/h1>\n\n\n\n<p>iptables -D &lt;\u30eb\u30fc\u30eb\u756a\u53f7&gt;<br>iptables -D INPUT 1<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u6307\u5b9aIP\u304b\u3089\u306e\u901a\u4fe1\u3092\u7834\u68c4<\/h1>\n\n\n\n<p>iptables ?A INPUT ?s 192.168.0.25 ?j DROP<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u6307\u5b9aIP\u7bc4\u56f2\u304b\u3089\u306e\u901a\u4fe1\u3092\u7834\u68c4<\/h1>\n\n\n\n<p>iptables ?A INPUT ?s 192.168.0.0\/24 ?j DROP<br>List all rules in a table by line numbers<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u884c\u756a\u53f7\u4ed8\u304d\u3067\u30eb\u30fc\u30eb\u4e00\u89a7\u3092\u8868\u793a<\/h1>\n\n\n\n<p>iptables ?L &#8211;line-numbers<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u884c\u756a\u53f7\u306b\u3088\u308b\u30eb\u30fc\u30eb\u306e\u524a\u9664<\/h1>\n\n\n\n<p>iptables ?D INPUT 1<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u5168\u30eb\u30fc\u30eb\u306e\u524a\u9664<\/h1>\n\n\n\n<p>iptables ?F<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">ICMP\u3078\u306e\u901a\u4fe1\u3092\u62d2\u5426\uff08\u30ec\u30b9\u30dd\u30f3\u30b9\u3042\u308a\uff09<\/h1>\n\n\n\n<p>iptables -A INPUT -p icmp -j REJECT<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">ICMP\u3078\u306e\u901a\u4fe1\u3092\u7834\u68c4\uff08\u30ec\u30b9\u30dd\u30f3\u30b9\u306a\u3057\uff09<\/h1>\n\n\n\n<p>iptables -A INPUT -p icmp -j DROP<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u6307\u5b9a\u30dd\u30fc\u30c8\u3078\u306e\u901a\u4fe1\u3092\u7834\u68c4<\/h1>\n\n\n\n<p>iptables -A INPUT -p tcp &#8211;dport 80 -j DROP<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u7834\u68c4\u30eb\u30fc\u30eb\u3067\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3068IP\u306e\u4e21\u65b9\u3092\u6307\u5b9a<\/h1>\n\n\n\n<p>iptables -A INPUT -i enps03 -s 192.168.0.25 -j DROP<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u6307\u5b9aIP\u3078\u306e\u5916\u5411\u304d\u901a\u4fe1\u3092\u7834\u68c4<\/h1>\n\n\n\n<p>iptables ?A OUTPUT ?d 31.13.71.36 ?j DROP<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u6307\u5b9aIP\u7bc4\u56f2\u3078\u306e\u5916\u5411\u304d\u901a\u4fe1\u3092\u7834\u68c4<\/h1>\n\n\n\n<p>iptables ?A OUTPUT ?d 31.13.71.0\/24 ?j DROP<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">SSH\u4ee5\u5916\u306e\u5168\u3066\u306e\u5185\u5411\u304d\u901a\u4fe1\u3092\u7834\u68c4<\/h1>\n\n\n\n<p>iptables -A INPUT -p tcp &#8211;dport 22 -j ACCEPT<br>iptables -P INPUT DROP<\/p>\n\n\n\n<h1 class=\"wp-block-heading has-medium-font-size\">\u30eb\u30fc\u30eb\u306e\u4fdd\u5b58\/\u5fa9\u5143<\/h1>\n\n\n\n<p>iptables-save > filename<br>iptables-restore &lt; filename<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73fe\u5728\u306e\u8a2d\u5b9a\u78ba\u8a8d iptables -nL &#8211;line-numbers 80\u756a\u30dd\u30fc\u30c8\u3078\u306e\u901a\u4fe1\u3092\u62d2\u5426 iptables -A -s &lt;\u9001\u4fe1\u5143IP&gt; -d &lt;\u5b9b\u5148IP&gt; -p &lt;\u30d7\u30ed\u30c8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":289,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-382","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages\/382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=382"}],"version-history":[{"count":1,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages\/382\/revisions"}],"predecessor-version":[{"id":383,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages\/382\/revisions\/383"}],"up":[{"embeddable":true,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages\/289"}],"wp:attachment":[{"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}