我今天花了很多时间想办法解决这个问题,但我找不到解决办法。在我看来,这应该是可能的。我正在尝试设置以下设置:
读取tap1接口并使用Go转发到enp0s3应该没有任何问题.我希望如此。如果我做了一个ping 10.0.0.10 -I tap1,我可以在Go应用程序中看到以太帧。(我目前使用的是https://github.com/songgao/water,但如果我能做到这一点,我可能会迁移到https://github.com/mdlayher/packet )
我遇到的问题是将以太帧从enp0s8转发到tap1接口。我尝试过多个命令,但它不起作用。我试过使用iptables:
iptables -A FORWARD -i enp0s8 -o tap1 -j ACCEPT和类似的命令。
然后我发现了这个问题:Tap0 0未接收流量,王雪伍德在这里说:
If you want to force tap0 to recieve its own IP packets, you may use ebtables. When packets are DROPed in the ethernet layer of tap0 at broute table, these packets go into the the IP layer of tap0 instead of eth0. See also: http://ebtables.sourceforge.net/examples/real.html#example1听起来正是我想要的。我想我找到了他的意思是:https://ebtables.netfilter.org/examples/basic.html#ex_B路由器
ebtables -t broute -A BROUTING -p ipv4 -i tap1 --ip-dst 172.16.1.1 -j DROP
但是,我得到了以下错误:ebtables: No chain/target/match by that name。如果我查看man ebtables,就不会看到提到的broute表。我在这里确实看到了,https://linux.die.net/man/8/ebtables。那我是不是漏掉了什么?
我也尝试了ebtables -A FORWARD -i enp0s8 -o tap1 -j ACCEPT从https://www.linuxquestions.org/questions/linux-networking-3/ebtables-to-setup-forwarding-and-ethernet-level-nat-4175538316/,但这也不起作用。
发布于 2022-11-25 16:21:14
已经过了几个月了,你可能会也可能不会有这个问题,或者其他人可能会在未来偶然发现这个帖子。我也遇到了同样的情况。看来broute不是内置在当前版本的退潮中的。使用带有相同选项(我使用的是接受而不是拖放)的命令ebtables,它将按预期将规则添加到b路由表和函数中。
https://serverfault.com/questions/1095169
复制相似问题