Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to set up a redirect for 443 to 8443 (non-root app can not use privileged port) using the following:

iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443

However, when trying to connect on 443 (via localhost), I am getting a 'connection refused'. 8443 is open and functioning. I assume a 'connection refused' issue precludes response packets being dropped, as that would result in a timeout.

No other rules exist for filter, nat, mangle, or raw.

Distribution information:

# rpm -q iptables
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
share|improve this question
Found the answer here. I needed to add a separate rule for loopback to work: iptables -t nat -I OUTPUT -p tcp -d --dport 443 -j REDIRECT --to-ports 8443 – Ben Jan 15 '13 at 23:22
This should be an answer, not a comment. – Michael Hampton Jan 15 '13 at 23:26
Thanks for the tip. but as I am not yet privileged enough to answer my own questions in a timely manner, a comment will have to suffice. – Ben Jan 16 '13 at 3:31

PREROUTING is for NATting packets before they are routed. Locally-generated packets are OUTPUTted, not routed. So use the OUTPUT chain.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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