Why does NAT GW get two IP address EIP and Private IP Address



I need some help in understanding the use case of Elastic IP Address and Private IP Address that gets assigned to the NAT GW.

1- When a NAT GW is launched, it gets two IPs Elastic IP Address and Private IP Address. What IP does it use as the SRC IP when it forwards the traffic to the Internet Gateway. From Documentation "The NAT gateway sends the traffic to the internet gateway, using its Elastic IP address as the source IP address."

2- What IP [EIP or Private IP] does the Internet Gateway use for translation? From Documentation: "For communication using IPv4, the internet gateway also performs network address translation (NAT)"

If I try to combine above points then does Internet Gateway translate the EIP of the NAT GW to a publicly routable address as the src before sending it out on the internet?

asked 9 months ago250 views
2 Answers

I suggest to check this blog, it explains the packet flow and how the Source IP gets changed at each hop. See the below statement and the diagram along with the table showing packet flow.

AWS NAT Gateways performs Port Address Translation. AWS NAT Gateways performs source-NAT, and translates the IP address of the source with its private IP address. Then, the Internet Gateway (IGW) translates the private IP address of the NAT Gateway to the Elastic IP address associated with the NAT Gateway

profile pictureAWS
answered 9 months ago

To add some explanation to the above blog, when the packet reaches NAT-GW, The NAT-GW translates the source IP address to its private IP address then it forwards the packet to IGW. When the packet reaches the IGW, it performs another source IP translation where it uses the EIP, that's associated with the NAT-GW, as the packet source IP.

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions