ebtables使用

Targets:

(1)ACCEPT : 让帧通过

(2)DROP: 丢弃帧。

(3)CONTINUE:让帧继续走下面的规则(rule)  

(4)RETURN: 停止当前链的过滤规则,进而去走前面链的下一条规则

注意:在BROUTING链中ACCEPT和DROP有不同的含义:

TABLES:

内置三个表(tables):

(1)filter : 默认使用此表,并且无需使用 -t 或 -table参数

(2)nat

(3)broute

filter内置三个链(chain),分别为 INPUT 、OUTPUT、 FORWARD.

(1)INPUT:   帧的目的地址为设备

(2)OUTPUT:   从设备为源地址的帧

(3)FORWARD:   由设备进行转发的帧

nat:用来更改mac地址,包含三个内置链,分别为 PREROUTING 、OUTPUT、 POSTROUTING

(1)PREROUTING:  for altering frames as soon as they come in

(2)OUTPUT: for altering locally generated or (b)routed frames before they are bridged

(3)POSTROUTING: for altering frames as they are about to go out

broute:is used to make a brouter, 只有一个内置链(chain) BROUTING

(1)BROUTING: 此处的target (DROP /ACCEPT)有不同的含义。

DROP actually means the frame has to be routed, while ACCEPT means the frame has to be bridged.

参数简介:

(1) -A

        在选定的链后面加一条规则

     eg:  ebtables -A INPUT       (在filter表中添加INPUT链)

(2)-D

        从选定的链中删除一条或多条规则。

      eg:  ebtables -D INPUT  1:2  (将filter表中INPUT链的第1到第2条规则删除掉)

              ebtables -D OUTPUT 1 

(3)-I

        从选定的链中插入规则,默认插入到头部。如果指定

       eg:  ebtables -I INPUT  1 -p ipv4  --ip-src 192.168.1.1 -j DROP

(4)-P, --policy

       指定策略,可以为ACCEPT、DROP或 RETURN

(5)-F, --flush

       删掉所有的链

      eg:  ebtables -F

(6)-Z, --zero

       设置选定的链的计数为0

(7)-L, --list

       列出所有的规则

       eg:   ebtables  -L

      -Ln    列出所有规则,并且前面有规则的编码

      -Lc    列出所有规则,并且有匹配的统计。其中pcnt为帧数统计,bcnt为字节统计

  

  

(8)-N, --new-chain

      创建新的链路,默认的位ACCEPT,可以通过命令-P来进行更改。

(9)

原文地址:https://www.cnblogs.com/rohens-hbg/p/5486138.html