I have a service that listens to and would like to make that service listen to using just UFW (or iptables if not possible with UFW).

Basically listen same port (or not if impossible otherwise) and forward to the service.

Unfortunately, in my case it's not possible to change the service itself to listen to

  • I can change the port but not the bind/listening address. It's a custom compiled program provided by a 3rd party, unfortunately it's a strict requirement.
    – Sev
    Commented Sep 18, 2018 at 22:35

1 Answer 1


Try using netcat or socat.

The original netcat.
nc -l -p 15751 -c "nc 15750"

If that doesn't work for you use the full netcat command. It has different syntax, but you should be able to use it.

Use this link as a reference:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .