{"id":8067,"date":"2020-06-22T15:56:52","date_gmt":"2020-06-22T07:56:52","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=8067"},"modified":"2020-06-23T20:26:24","modified_gmt":"2020-06-23T12:26:24","slug":"ebtables","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/ebtables","title":{"rendered":"ebtables\u547d\u4ee4 – \u7f51\u7edc\u6570\u636e\u5305\u8fc7\u6ee4\u7684\u914d\u7f6e\u5de5\u5177"},"content":{"rendered":"\n

ebtables\u548ciptables\u7c7b\u4f3c\uff0c\u90fd\u662fLinux\u7cfb\u7edf\u4e0b\u7f51\u7edc\u6570\u636e\u5305\u8fc7\u6ee4\u7684\u914d\u7f6e\u5de5\u5177\u3002\u65e2\u7136\u79f0\u4e4b\u4e3a\u914d\u7f6e\u5de5\u5177\uff0c\u5c31\u662f\u8bf4\u8fc7\u6ee4\u529f\u80fd\u662f\u7531\u5185\u6838\u5e95\u5c42\u63d0\u4f9b\u652f\u6301\u7684\uff0c\u8fd9\u4e24\u4e2a\u5de5\u5177\u53ea\u662f\u8d1f\u8d23\u5236\u5b9a\u8fc7\u6ee4\u7684rules.<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>ebtables [\u53c2\u6570] <\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-F<\/td>\u5bf9\u6240\u6709\u7684\u89c4\u5219\u8868\u7684\u89c4\u5219\u94fe\u6e05\u7a7a<\/td><\/tr>

-L<\/td>
\u6307\u660e\u89c4\u5219\u8868\u3002\u53ef\u52a0\u53c2\u6570\uff0c--Lc,--Ln<\/td><\/tr>

-p<\/td>
\u6307\u660e\u4f7f\u7528\u7684\u534f\u8bae\u7c7b\u578b\uff0cipv4,arp\u7b49\u53ef\u9009\uff08\u4f7f\u7528\u65f6\u5fc5\u9009\uff09\u8be6\u60c5\u89c1\/etc\/ethertypes<\/td><\/tr>
--ip-proto<\/td>IP\u5305\u7684\u7c7b\u578b\uff0c1\u4e3aICMP\u5305\uff0c6\u4e3aTCP\u5305\uff0c17\u4e3aUDP\u5305\uff0c\u5728\/etc\/protocols\u4e0b\u6709\u8be6\u7ec6\u8bf4\u660e<\/td><\/tr>
-t table<\/td>\u4e00\u822c\u4e3aFORWARD\u94fe<\/td><\/tr>
--ip-src<\/td>IP\u5305\u7684\u6e90\u5730\u5740<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u8bbe\u7f6e\u8f6c\u53d1\u8868\u9ed8\u8ba4\u52a8\u4f5c\u4e3a\u63a5\u53d7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# ebtables -P FORWARD ACCEPT<\/pre>\n\n\n\n

\u67e5\u770b\u73b0\u6709\u9632\u706b\u5899\u89c4\u5219\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# ebtables -L<\/pre>\n\n\n\n

\u6dfb\u52a0eth1\u5165\u65b9\u5411\u539f\u7aef\u53e3\u4e3a80\u7684\u4e22\u5f03\u89c4\u5219\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# ebtables -A FORWARD -i eth1 -p ipv4 \u2013p-proto tcp \u2013p-sport 80 -j DROP<\/pre>\n\n\n\n

\u6e05\u7a7a\u89c4\u5219\u8868\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# ebtables -F<\/pre>\n","protected":false},"excerpt":{"rendered":"

ebtables\u548ciptables\u7c7b\u4f3c\uff0c\u90fd\u662fLinux\u7cfb\u7edf\u4e0b\u7f51\u7edc\u6570\u636e\u5305\u8fc7\u6ee4\u7684\u914d\u7f6e\u5de5\u5177\u3002\u65e2\u7136\u79f0\u4e4b\u4e3a\u914d\u7f6e\u5de5\u5177\uff0c\u5c31\u662f […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8067"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=8067"}],"version-history":[{"count":2,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8067\/revisions"}],"predecessor-version":[{"id":8104,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/8067\/revisions\/8104"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=8067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=8067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=8067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}