ebtables中的broute表功能:
用于控制进来的数据包是需要进行bridge转发还是进行route转发,即2层转发和3层转发。
BROUTING的ACCEPT/DROP和FORWARD中的区别:
ACCEPT |
DROP |
|
BROUTING |
bridge it |
route it |
FORWARD |
接收该包,当前主Chain后面的rule则不再需要对其进行匹配处理 |
丢弃该包 |
注:
1、当在BROUTING中执行DROP时,它会在下图的broute/brouting点中直接将包转入iptables;
下表是LAN(192.168.10.2/34:e6:d7:21:0f:65)–PING–>NAT(LAN:192.168.10.1/70:f1:a1:aa:0e:01; WAN:192.168.1.147/70:F1:A1:AA:0E:00)–>WAN PC:(192.168.1.253/00:23:cd:9c:e7:0a)在Netfilter中的流向。(可ping通)
注:在ebtables的BROUTING中对LAN–>WAN方向的数据包添加DROP规则。
LAN–>WAN:
EBT-BROUTING-LAN
: IN=eth1 OUT= MAC source = 34:e6:d7:21:0f:65 MAC dest = 70:f1:a1:aa:0e:01 proto = 0x0800
IPT-MANGLE-PREROUTING-LAN
:IN=eth1 OUT= MAC=70:f1:a1:aa:0e:01:34:e6:d7:21:0f:65:08:00 SRC=192.168.10.2 DST=192.168.1.253 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=16172 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=13397
IPT-NAT-PREROUTING-LAN
:IN=eth1 OUT= MAC=70:f1:a1:aa:0e:01:34:e6:d7:21:0f:65:08:00 SRC=192.168.10.2 DST=192.168.1.253 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=16172 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=13397
IPT-MANGLE-FORWARD-LAN
:IN=eth1 OUT=br-lan0 SRC=192.168.10.2 DST=192.168.1.253 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=16172 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=13397
IPT-FORWARD-LAN
:IN=eth1 OUT=br-lan0 SRC=192.168.10.2 DST=192.168.1.253 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=16172 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=13397
IPT-NAT-POSTROUTING-LAN
:IN= OUT=br-lan0 SRC=192.168.10.2 DST=192.168.1.253 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=16172 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=13397
EBT-POSTROUTING-WAN
: IN= OUT=eth0.0 MAC source = 70:f1:a1:aa:0e:00 MAC dest = 00:23:cd:9c:e7:0a proto = 0x0800
WAN–>LAN:
EBT-BROUTING-WAN
: IN=eth0.0 OUT= MAC source = 00:23:cd:9c:e7:0a MAC dest = 70:f1:a1:aa:0e:00 proto = 0x0800
EBT-NAT-PREROUTING-WAN
: IN=eth0.0 OUT= MAC source = 00:23:cd:9c:e7:0a MAC dest = 70:f1:a1:aa:0e:00 proto = 0x0800
IPT-MANGLE-PREROUTING-WAN
:IN=br-lan0 OUT= PHYSIN=eth0.0 MAC=70:f1:a1:aa:0e:00:00:23:cd:9c:e7:0a:08:00 SRC=192.168.1.253 DST=192.168.1.147 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=9511 PROTO=ICMP TYPE=0 CODE=0 ID=1 SEQ=13400
EBT-INPUT-WAN
: IN=eth0.0 OUT= MAC source = 00:23:cd:9c:e7:0a MAC dest = 70:f1:a1:aa:0e:00 proto = 0x0800
IPT-MANGLE-FORWARD-WAN
:IN=br-lan0 OUT=eth1 PHYSIN=eth0.0 SRC=192.168.1.253 DST=192.168.10.2 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=9511 PROTO=ICMP TYPE=0 CODE=0 ID=1 SEQ=13400
IPT-FORWARD-WAN
:IN=br-lan0 OUT=eth1 PHYSIN=eth0.0 SRC=192.168.1.253 DST=192.168.10.2 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=9511 PROTO=ICMP TYPE=0 CODE=0 ID=1 SEQ=13400
2、如果一个以太网接口eth1,它并没有桥接到br-lan0中,此时,从eth1进来的数据包不会走到ebtables中。
它会在下图中的bridge check点,检查数据包进入的接口是否属于某个桥,如果是则走ebtables,否则直接走iptables。