Why port redirection using iptables NAT sometimes does not work ?

Solution Unverified - Updated -

Issue

  • Port redirection can be done using iptables rules as following
iptables -t nat -A PREROUTING -i bond0 --dst x.x.x.x -p tcp --dport 1234 -j REDIRECT --to-port 4321
iptables -t nat -A PREROUTING -i bond1 --dst y.y.y.y -p tcp --dport 1234 -j REDIRECT --to-port 4321
  • But after some time these rule does not seem to work.

  • When we use following command to see whether the ports we are using in iptables rules are open or not, the NAT rules start working again.

nmap -sX x.x.x.x 

Environment

  • Red Hat Enterprise Linux Server release 5, 6
  • iptables

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content