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?
By default, the
filter
table is used. Tryiptables -t nat -nvL
.