I am using iptables redirection to make a Tomcat on RHEL7 accessible on port 443 (for https traffic) as described here. The important rules should be those three:
iptables -A INPUT -p tcp --dport 443 -i eth3 -j ACCEPT iptables -A INPUT -p tcp --dport 8443 -i eth3 -j ACCEPT iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 8443 iptables -A INPUT -m state --state ESTABLISHED,RELATED -i eth3 -j ACCEPT # Drop all other incoming packets on the interface eth3 iptables -A INPUT -i eth3 -j DROP
So what I do not understand is why I need the rule to open port 8443 to the outside? When I close it and only open 443, it does not work. To my understanding the redirection should happen internally, doesn't it? Or can this be somehow configured differently?
Remark: eth3 is the one interface I actually do need to protect. There are others as well, but those are only internal ones.