iptables UDP SNAT rule is only applied to some traffic

Solution Verified - Updated -

Issue

  • iptables UDP SNAT rule is only applied to some traffic
  • Using Source NAT to change the local IP address of UDP traffic, only locally-generated traffic has the NAT rule applied, replies to traffic generated from remote sources do not have the NAT applied
  • An example iptables rule may be:
    iptables -t nat -I POSTROUTING -p udp -j SNAT --to 172.16.1.111

Environment

  • Red Hat Enterprise Linux 7
  • iptables with SNAT target to perform Source NAT (Network Address Translation)
  • UDP (User Datagram Protocol) though probably applies to other protocols as well

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