I'm using this rule to configure SNAT:
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 18.104.22.168:4000
I want to specify a rule to filter out packets not destined to the internal address and port that initiated the session. Additionally, for receiving packets from a specific external endpoint, it is necessary for the internal endpoint to send packets first to that specific external endpoint's IP address.(NAT Address Dependent Filtering)
A machine with internal IP and port (X:x) which is behind the NAT opens a connexion to a server with IP Y. So with the rule I must be able to allow only connexion coming from IP address Y and destined to (X:x). All other connexion will be droped.