title: Is it possible to apply an iptables rule only for internal ips?
body: <p>Currently, I have a NAT instance in AWS with some iptables rules, such as to forward the traffic that comes in a certain port to some other instance. So, if I do <code>curl nat.address.com:8090</code>, the traffic is forwarded to some other instance that is listening to the 8090 port, let's say it is instance A.</p>
  
  <p>What I want is to know how to apply this rule only if the original source is inside the local network. That is, if the request to <code>nat.address.com:8090</code>comes from an internal instance with ip <code>172.31.10.10</code>, the nat instance should forward it to instance A. However, if the request to <code>nat.address.com:8090</code> comes from some external source (e.g. <code>189.58.200.10</code>), it should not forward. </p>
  
  <p>Is it possible?</p>