iptables port forwarding troubleshooting

Posted by cbmanica on Server Fault See other posts from Server Fault or by cbmanica
Published on 2013-10-22T01:36:57Z Indexed on 2013/10/22 3:57 UTC
Read the original article Hit count: 374

Filed under:
|
|

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
*nat
:PREROUTING ACCEPT [2:280]
:POSTROUTING ACCEPT [12:768]
:OUTPUT ACCEPT [12:768]
-A PREROUTING -p tcp -m tcp --dport 18600 -j REDIRECT --to-ports 9980
COMMIT
# Completed on Mon Oct 21 18:30:43 2013

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

Table: nat
Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         
1    REDIRECT   tcp  --  0.0.0.0/0            0.0.0.0/0           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.)

© Server Fault or respective owner

Related posts about centos

Related posts about iptables