Connecting two modbus devices over ethernet with KNOTs

I have two modbus devices, one master and one slave and I need to connect them over ethernet (actually ethernet-over-powerline, but that’s solved).
And I also have two KNOT’s one for each device.

I can connect KNOT to slave device, enable modbus-over-tcp and connect to it via apps on my computer.
I can also connect KNOT to master device, enable serial-port-over-tcp (or was it udp?) and write a small app and indeed modbus requests arrive into my socket.

Now can I somehow connect two so they forward traffic to each other?

Thanks!

Ok some progress,

My master device is sending only one known-ahead-of-time fixed modbus request, so I can “emulate” it from my proxy program and then just forward response data over.
So currently my setup looks like this:

  • KNOT #1 connected in RTU->TCP mode to master device
  • KNOT #2 connected in RTU->TCP mode to slave device
  • KNOT #1 ignores requests from master device, seems to be limitation of IOT package itself
  • An app on PC connected to both KNOT’s via two TCP connections
  • App sends an exact request to KNOT #2 as it would come from master device directly, I know the request payload and it never changes, so I can hardcode it in my case
  • App receives response from KNOT #2 and writes it directly to KNOT #1

Now I’m thinking how could I run this as a script on KNOT itself, doesn’t seem possible because “iot modbus read-holding-registers” sends function=3 on the wire (I’ve checked with oscilloscope), but my slave device only responds to reading input registers which is function=4 …