2020年12月1日 星期二

2020年1月8日 星期三

ebtable staudy


ebtables

默認有三個Table (filter,nat,broute)

filter 內建三個chain:INPUT/OUTPUT/FORWARD

nat 內建三個chain:PREROUTING/OUTPUT/POSTROUTING

broute內建一個chain : BROUTING



*顯示table

ebtables [-t filter] -L 顯示filter table的內容,默認也是顯示該table

ebtables -t broute -L 顯示broute table的內容

ebtables -t nat -L 顯示nat table的內容



增加一個chain

ebtables -t filter -N newChain -P ACCEPT



但此時不會有封包走到此chain,須將 chain 加到 linux 內建的 hook chain上

ebtables -t filter -A INPUT -j newChain 


ebtables -t filter -L

Bridge chain: INPUT, entries: 1, policy: ACCEPT

-j newChain 



ebtables [-t table ] -[ACDI] chain rule specification [match extensions] [watcher extensions] target    // append, delete, change-counters, insert

ebtables [-t table ] -P chain ACCEPT | DROP | RETURN                                                                      // policy, Set the policy for the chain to the given target

ebtables [-t table ] -F [chain]                                                                                                           // flush, Flush the selected chain

ebtables [-t table ] -Z [chain]                                                                                                           // zero, Set the counters of the selected chain to zero

ebtables [-t table ] -L [-Z] [chain] [ [--Ln] | [--Lx] ] [--Lc] [--Lmac2]                                                  // list, List all rules in the selected chain. If no chain is selected, all chains are listed.

                              // -L -Z , When both the -Z and -L commands are used together in this way, the rule counters are printed on the screen before they are set to zero.

                              // -L --Ln, Shows the counters at the end of each rule displayed by the -L command.

ebtables [-t table ] -N chain [-P ACCEPT | DROP | RETURN]                                                               // new-chain

ebtables [-t table ] -X [chain]                                                                                                           // delete-chain

ebtables [-t table ] -E old-chain-name new-chain-name                                                                    // rename-chain

ebtables [-t table ] --init-table                                                                                                         // Replace the current table data by the initial table data

ebtables [-t table ] [--atomic-file file] --atomic-commit

ebtables [-t table ] [--atomic-file file] --atomic-init

ebtables [-t table ] [--atomic-file file] --atomic-save





ebtables [-t table ] -[ACDI] chain rule specification [match extensions] [watcher extensions] target

ebtables [-t table ] -P chain ACCEPT | DROP | RETURN

ebtables [-t table ] -F [chain]

ebtables [-t table ] -Z [chain]

ebtables [-t table ] -L [-Z] [chain] [ [--Ln] | [--Lx] ] [--Lc] [--Lmac2]

ebtables [-t table ] -N chain [-P ACCEPT | DROP | RETURN]

ebtables [-t table ] -X [chain]

ebtables [-t table ] -E old-chain-name new-chain-name

ebtables [-t table ] --init-table

ebtables [-t table ] [--atomic-file file] --atomic-commit

ebtables [-t table ] [--atomic-file file] --atomic-init

ebtables [-t table ] [--atomic-file file] --atomic-save