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

I'm trying to forward connections on port 18600 to port 9980. I have this in /etc/sysconfig/iptables:

# Generated by iptables-save v1.3.5 on Mon Oct 21 18:30:43 2013
-A PREROUTING -p tcp -m tcp --dport 18600 -j REDIRECT --to-ports 9980
# Completed on Mon Oct 21 18:30:43 2013

and /etc/init.d/iptables status shows me this:

Table: nat
num  target     prot opt source               destination         
1    REDIRECT   tcp  --             tcp dpt:18600 redir ports 9980 

However, I can telnet from localhost to port 9980, but not 18600. What am I missing? (This is a CentOS-based VM.)

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Packets from the local machine do not pass through the NAT PREROUTING table.

Test from another machine.

If you need to DNAT the traffic that originates from the local machine, use the NAT OUTPUT table.

share|improve this answer
Ah, I had no idea a different table was involved for local traffic. NAT OUTPUT was exactly what I needed. – cbmanica Oct 22 '13 at 16:25

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.