Port Forwarding in Red Hat Version 7


Hello everyone I have a query regarding port forwarding in which i am confused kindly help me because I have to appear for exam.

Question : All traffic of port no 5432 of stationx should be forwarded to port no 80.

I am looking for the solution from both rich rule or simple firewall rule.



Check this out:

# firewall-cmd --permanent --add-forward-port=port=5432:proto=tcp:toport=80 to other host x.x.x.x on port 80 from stationx 5432 # firewall-cmd --permanent --add-forward-port=port=5432:proto=tcp:toport=80:toaddr=x.x.x.x


thanks a lot sir
its a great help for me.


thanks a lot sir
its a great help by you


sir can you do a little more help for me?
can you do this question via Rich Rule?


sir try this

man firewalld.richlanguage

firewall-cmd --add-rich-rule= ‘rule family=“ipv4” forward-port to-addr= “specify you ip here” to-port=“5432” protocol= “tcp” port = “80”’

that's all.