A
A
Alf19902020-01-14 13:01:30
Debian
Alf1990, 2020-01-14 13:01:30

How to forward a port through UFW?

Can you please tell me how, using UFW, you can forward connections on port 80 to port 500?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lev Zabudkin, 2020-01-15
@zabudkin

First we allow port 80:
sudo ufw allow 80/tcp
ufw itself doesn't have commands to redirect, so you need to change its configs, Add the following lines to the
/etc/ufw/before.rules file, before the filter section
:
:0]
-A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 500
COMMIT

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question