Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to forward the traffic from port 1111 to port 2222. So I execute the iptables command, but it seems that, somehow, the rule is not being saved.

# iptables -t nat -A PREROUTING -p tcp --dport 1111 -j REDIRECT --to-port 2222
# iptables -L -v
Chain INPUT (policy ACCEPT 24845 packets, 35M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 24720 packets, 35M bytes)
 pkts bytes target     prot opt in     out     source               destination

I would expect that the iptables -L -v command would show the rule that I just created. It works for other rules but for this one it doesn't.

Am I missing something?

share|improve this question
    
By default, the filter table is used. Try iptables -t nat -nvL. –  Spack Apr 15 at 12:11
    
Thank you, it works. Please feel free to add the comment as an answer so I can accept it. –  Razvan Apr 15 at 12:16

1 Answer 1

up vote 1 down vote accepted

By default, the filter table is used. Try iptables -t nat -nvL.

share|improve this answer

Your Answer

 
discard

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.