首页 > 解决方案 > 从 OpenBSD 重定向镜像流量

问题描述

我有一个运行 OpenBSD 的软件路由器和一个在单独物理机上的 VM 上的 DPI 服务。

我希望所有通过的流量都从 OpenBSD 机器在线镜像到 DPI 机器(不是批量,而是合理地最小化延迟)。我知道一种tcpdump通过 SSH 将输出隧道传输到侦听主机并tcpreplay在那里 ing 的方法,但感觉真的很hacky。

我的设置有什么合适的方法?像GRE镜像这样的隧道?

标签: virtual-machineopenbsdnetwork-monitoring

解决方案


如果我理解正确,这可以通过桥来完成。假设您在 if1 上有传入流量,在 if2 上有传出流量,并且您有一个与 DPI 机器背靠背的 if3 并且启用了 IP 转发。那么你可以

ifconfig bridge0 create
ifconfig bridge0 add if1 add if2 up
ifconfig bridge0 addspan if3

然后根据 man 4 桥

SPAN PORTS
     The bridge can have interfaces added to it as span ports.  Span ports
     transmit a copy of every frame received by the bridge.  This is most
     useful for snooping a bridged network passively on another host connected
     to one of the span ports of the bridge.  Span ports cannot be bridge
     members; instead, the addspan and delspan commands are used to add and
     delete span ports to and from a bridge.

推荐阅读