Iptables – Undoing port forwarding

iptablesport-forwarding

I need all requests to port 80 to be forwarded to 8020. I Googled it and I got:

iptables -t nat -I PREROUTING --source 0/0 --destination 0/0 -p tcp --dport 80 -j REDIRECT --to-ports 8020

Now in the future if I have to undo it what do I do (apart from restarting the system)?

Best Answer

Just delete the rule:

iptables -t nat -D PREROUTING --source 0/0 --destination 0/0 -p tcp --dport 80 -j REDIRECT --to-ports 8020