Redirecting to another port

Hello guys,

I need a little help on redirecting traffic to another port.

The case is:

I have a machine controller which I want to connect to a printer. The machine controller has IP 192.168.50.100 and is only able to use port 5000. The printer has IP 192.168.50.101 and is only able to use port 23. I want to use a router to redirect the traffic from port 5000 to port 23 and back.

I am struggeling for a few hours now but cant get it to work. I have searched in the topics but most topics are about port forwarding from wan and this is setup doesnt have a wan.

Can someone give me a small push in the right direction?

Thanks!

The problem I see is that you use port 500 for all machine device traffic so intercepting port 500 traffic to send to the printer would block all other machine device traffic? At least that seems the logical issue. In other words, how does the router know when to direct the traffic from the machine to the printer???

If you don’t have some unusual setup, both controller and printer are in same subnet. So if they want to communicate with each other, they will do it directly, they won’t send anything to router. And if router doesn’t get it, it can’t do anything with it.

It could be possible to do something, but it depends on details, for start, how exactly is everything connected (both devices connected to this router, or using another switch, …).

Also are you sure that the printer on port 23 uses the same communication protocol as controller on port 5000? Because if not, the whole exercise is pointless.

Thanks for your reply,

The only reason I want to use the router is because of the redirection. Normally it is just a point to point connection between printer and computer. So there is nothing in the network exept for the printer and the computer/machine controller. Also it is not connected to the internet.

Yes I am sure the protocols are the same. It are just some text strings I have to send over

Thank you

You’ll have to use /interface bridge settings set use-ip-firewall=yes, disable HW acceleration on one (or both) involved ether ports (to force traffic through router’s CPU) and then construct appropriate NAT rules (probably a single rule would do but make it specific enough so that it doesn’t mess with packets that it’s not supposed to).

Lets say you have a Router, a Printer and a PC
Printer does listen on port 9200.
Normal you could setup a print queue on the PC that points to Printer/9200
For some reason PC can not use port 9200.

So you could then setup Router to listen in port 8000.
Make the Router NAT port 8000 to Printer/9200
PC sets up a queue to Router/8000.

I think that should be doable.

This works. Thank you very much for your help and also the other forum members for their reply.