Im currently using ufw to enforce some basic firewall rules. Is it possible to also use ufw to do port forwarding?

Specifically im wanting to forward incoming traffic to my server (same machine running ufw) on port 80 to port 8080. (http traffic forwarded to tomcat)

Th

link|improve this question
feedback

1 Answer

up vote 4 down vote accepted

Add before filter section in /etc/ufw/before.rules(top of file):

*nat
:PREROUTING ACCEPT [0:0]
-A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
COMMIT

Then restart ufw.

link|improve this answer
could you explain this line by line please? also, is there not something like ufw forward 80 to 8080? I thought UFW was Uncomplicated. – Tom Mar 11 at 11:58
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.