如何区分 ZeroMQ 数据包和正常流量
How to differentiate ZeroMQ packets from normal traffic
我正在模拟以下场景:
There are two routers, A and B, both with Internet access and also connected to each other via an internal private network (an Ethernet cable between them, basically). They each serve N clients (each router as its own client-side network). The routers send each other keepalive-like messages through a ZeroMQ publisher-subscriber scheme through the private network.
Moreover, when A is congested, it must send its clients traffic
to B (and vice-versa), which will forward that traffic to the Internet
and thus "help" the congested router (temporarily).
考虑到两个路由器都是 Linux,我想将 A 的默认网关更改为 B 的私有网络接口 IP 足以将流量引入 B(通过公共内部专用网络)。
但是,当B从A的客户端接收流量时,必须注意不要转发到互联网(外部网络)包含 ZeroMQ 应用程序之间交换的消息的包。
我的问题是: B 如何知道并区分接收到的数据包中来自客户端数据包的 ZeroMQ 消息(来自A)?
用iptables/nfqueue抓包然后分析?如果是这样,如何识别发往 ZeroMQ 应用程序的数据包?
这一切都是考虑到 B 会将在连接到专用网络的接口中收到的所有数据包转发到 Internet(向上)。
注意:我不知道这是否与问题相关,但在订户应用程序中,对收到的消息应用了过滤器。每条以“network_zmq”开头的消息都被订阅者捕获。
编辑: 我还在 A 和 B 之间交换 ICMP 数据包 (ping) (这是我的场景中的要求)。这意味着从 A 到 B 的 ICMP 请求也不能转发到 Internet。
Q : How to differentiate ZeroMQ packets from normal traffic?
回答一个简单的问题并不容易。 ZeroMQ 不仅仅是发送一些数据包。
ZeroMQ 数据包可能使用(如果通过 L3+ 网络基础设施)几种不同的传输方式-class-es { tcp:// | pgm:// | epgm:// | vmci:// }
如果有这种需要,可以在应用程序端对这种数据包流量进行弱标记,如果将其配置为设置 TOS
- 用于此类标记的活动声明的标签 .setsockopt( ZMQ_TOS, aToS_VALUE )
Sets the ToS fields (Differentiated services (DS) and Explicit Congestion Notification (ECN) field of the IP header
Q : how can B know and differentiate, in the received packets, the ZeroMQ messages from the client packets (from A)?
这部分比较难。如上所述,基于 ToS
的弱检测是可能的,其余的数据包处理取决于 L3+ ROUTER 软件功能,而不是原样的 ZeroMQ .
如果来自 A 的某些客户端数据包具有与旨在标记源自 ZeroMQ 的流量相同的 ToS 标签,典型的 L3+ ROUTER 软件没有机会区分这种情况(它可能会构建一些试探法和 "guesstimate",但恕我直言,L3+ ROUTER 软件从那时起就主要以性能为中心(在 I/F 之间尽可能快地移动数据包),而不是 "fully-programmable"-用户定义-嗅探器平台或自适应策略执行平台)
构建 ZeroMQ 代理(中间人)可能会帮助您解决注入 MITM 节点未违反法律约束义务的情况。
我正在模拟以下场景:
There are two routers, A and B, both with Internet access and also connected to each other via an internal private network (an Ethernet cable between them, basically). They each serve N clients (each router as its own client-side network). The routers send each other keepalive-like messages through a ZeroMQ publisher-subscriber scheme through the private network.
Moreover, when A is congested, it must send its clients traffic to B (and vice-versa), which will forward that traffic to the Internet and thus "help" the congested router (temporarily).
考虑到两个路由器都是 Linux,我想将 A 的默认网关更改为 B 的私有网络接口 IP 足以将流量引入 B(通过公共内部专用网络)。
但是,当B从A的客户端接收流量时,必须注意不要转发到互联网(外部网络)包含 ZeroMQ 应用程序之间交换的消息的包。
我的问题是: B 如何知道并区分接收到的数据包中来自客户端数据包的 ZeroMQ 消息(来自A)?
用iptables/nfqueue抓包然后分析?如果是这样,如何识别发往 ZeroMQ 应用程序的数据包?
这一切都是考虑到 B 会将在连接到专用网络的接口中收到的所有数据包转发到 Internet(向上)。
注意:我不知道这是否与问题相关,但在订户应用程序中,对收到的消息应用了过滤器。每条以“network_zmq”开头的消息都被订阅者捕获。
编辑: 我还在 A 和 B 之间交换 ICMP 数据包 (ping) (这是我的场景中的要求)。这意味着从 A 到 B 的 ICMP 请求也不能转发到 Internet。
Q : How to differentiate ZeroMQ packets from normal traffic?
回答一个简单的问题并不容易。 ZeroMQ 不仅仅是发送一些数据包。
ZeroMQ 数据包可能使用(如果通过 L3+ 网络基础设施)几种不同的传输方式-class-es { tcp:// | pgm:// | epgm:// | vmci:// }
如果有这种需要,可以在应用程序端对这种数据包流量进行弱标记,如果将其配置为设置 TOS
- 用于此类标记的活动声明的标签 .setsockopt( ZMQ_TOS, aToS_VALUE )
Sets the ToS fields (Differentiated services (DS) and Explicit Congestion Notification (ECN) field of the IP header
Q : how can B know and differentiate, in the received packets, the ZeroMQ messages from the client packets (from A)?
这部分比较难。如上所述,基于 ToS
的弱检测是可能的,其余的数据包处理取决于 L3+ ROUTER 软件功能,而不是原样的 ZeroMQ .
如果来自 A 的某些客户端数据包具有与旨在标记源自 ZeroMQ 的流量相同的 ToS 标签,典型的 L3+ ROUTER 软件没有机会区分这种情况(它可能会构建一些试探法和 "guesstimate",但恕我直言,L3+ ROUTER 软件从那时起就主要以性能为中心(在 I/F 之间尽可能快地移动数据包),而不是 "fully-programmable"-用户定义-嗅探器平台或自适应策略执行平台)
构建 ZeroMQ 代理(中间人)可能会帮助您解决注入 MITM 节点未违反法律约束义务的情况。