(host A)-------(bridge B)------(host C)
где:
MAC A
на его интерфейсеMAC C
на его интерфейсеMAC BA
и MAC BC
на нем два интерфейса (в зависимости от того, с кем он сталкивается)MAC BB
для его мостамост соединяет два интерфейса вместе, и ebtables и iptables используются для фильтрации.
Если я установлю свое единственное правило ebtables для перенаправления всех IPv4-содержащих фреймов на фильтрацию L3:
ebtables -t broute -A BROUTING -p IPV4 -i eth1 -j redirect --redirect-target DROP
тогда, если я отправлю кадр из A в C, содержащий IPv4, я должен получить MAC-адрес назначения как один из интерфейса моста (MAC BA
), когда я запускаю фильтрацию L3, если я верю документации.
redirect
The redirect target will change the MAC target address to that of the bridge device the frame arrived on. This target can only be used in the
BROUTING chain of the broute table and the PREROUTING chain of the nat table. In the BROUTING chain, the MAC address of the bridge port is
used as destination address, in the PREROUTING chain, the MAC address of the bridge is used.
--redirect-target target
Specifies the standard target. After doing the MAC redirect, the rule still has to give a standard target so ebtables knows what to do.
The default target is ACCEPT. Making it CONTINUE could let you use multiple target extensions on the same frame. Making it DROP in the
BROUTING chain will let the frames be routed. RETURN is also allowed. Note that using RETURN in a base chain is not allowed.
Когда я настроил iptables для регистрации входящих пакетов:
iptables -t raw -A PREROUTING -j LOG --log-prefix "ip_raw_prerouting: " --log-level debug
Я вижу, что iptables получают кадры с MAC BA
как источник и MAC A
в качестве пункта назначения вместо того, что я ожидал (MAC A
как - без изменений - источник и MAC BA
как новый пункт назначения)
MAC A
знак равно 08:00:27:17:49:6d
MAC C
знак равно 08:00:27:d5:24:36
MAC BA
знак равно 08:00:27:d8:32:61
На мосту:
kern.log
Aug 19 17:51:05 spy kernel: [20963.557665] br_br IN=eth1 OUT= MAC source = 08:00:27:17:49:6d MAC dest = 08:00:27:d5:24:36 proto = 0x0800
Aug 19 17:51:05 spy kernel: [20963.557701] ip_raw_pre: IN=eth1 OUT= MAC=08:00:27:d8:32:61:08:00:27:17:49:6d:08:00 SRC=192.168.142.254 DST=192.168.142.103 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=55401 DF PROTO=TCP SPT=46721 DPT=443 WINDOW=14600 RES=0x00 SYN URGP=0
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP qlen 1000
link/ether 08:00:27:df:b7:98 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP qlen 1000
link/ether 08:00:27:d8:32:61 brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
link/ether 08:00:27:d8:32:61 brd ff:ff:ff:ff:ff:ff
Есть идеи, что это может быть? любая дополнительная информация приветствуется!
другие теги (у меня здесь недостаточно репутации): ebtables, netfilter, brouter
На самом деле это все нормально.
В журнале MAC = 08: 00: 27: d8: 32: 61: 08: 00: 27: 17: 49: 6d: 08: 00 на самом деле destMAC: sourceMAC: proto