NAT implementation
- Outgoing datagrams: replace (source IP address, port number) of every outgoing datagram to (NAT IP address, new port number)
. . . remote clients/servers will respond using (NAT IP address, new port number) as destination address - Remember in NAT translation table every (source IP address, port number) to (NAT IP address, new port number) translation pair
- Incoming datagrams: replace (NAT IP address, new port number) in destination fields of every incoming datagram with corresponding (source IP address, port number) stored in NAT table
Figure 10 NAT router translates from private IP to public IP to send a datagram to the Internet
Click to enlarge
en:/Images by Yangliy from Wikipedia Public Domain
Figure 11 NAT router translates public IP to private IP to send a datagram from the Internet to the private network
Click to enlarge
self-created image of NAT for returning packet en:/Images by Yangliy from Wikipedia Public Domain