0

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?

2
  • By default, the filter table is used. Try iptables -t nat -nvL.
    – Spack
    Apr 15, 2014 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, 2014 at 12:16

1 Answer 1

1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .