I am inserting my network node between 2 legacy devices that exchange tcp and udp messages using dedicated ports, in both directions. My new node needs to push some tcp/udp messages through transparently, and intercept other tcp/udp messages for application-layer processing before sending on the processed messages. The diagram for this "man in the middle" like configuration is:
[ legacy1 ] -- [ mitm ] -- [ legacy2 ]
with these interfaces
- legacy1 is at 192.168.1.2
- legacy2 is at 192.168.1.3
- mitm (left) is 192.168.1.3 for intercepted right-moving messages, and invisible for forwarded messages
- mitm (right) is 192.168.1.2 for intercepted left-moving messages, and invisible for forwarded message
The MITM machine is running Ubuntu 16.04.
Would iptables be enough (at 3rd layer) although I want to bridge (at 2nd layer)? Would ebtables or nftables be better?