If you are working as a DevOps you must have heard the name NAT. In this article, we will talk about them and SNAT and DNAT.
NAT (Network Address translator) is generally used when you want to hide one side of the network and show it as a single IP. NAT keep a connection table so that it can forward the returning traffic to the private location. NAT make changes to either source or the destination address in headers and then forwards the packet. Based on this header change, NAT is divided into SNAT or DNAT.
In this type of NAT, the source IP of the packet changes and then passes it to the interface. In this case, the destination will not be able to see who actually created the requests. SNAT allow hosts inside to connect to particular host outside.
All the hosts behind the SNAT are identified as one entity. This helps in scenarios where you want the third parties to whitelist your IP’s so that they can identify you. In this case, you create a SNAT and they can identify you by your SNAT IP.
These are the NATs where destination IPs are changed in headers and then passed to the interface. DNAT allows hosts from outside to connect to particular host inside.
This can be used in the example where you want to host it something locally with private up and want your NAT box to forward to this host whenever someone tries to contact to NAT IP. So, in short, your NAT IP will be your website IP.
Both of these NATs keep a connection table with them where they keep track of what headers they changed and the mapping to which it is changed to. So that they can pass the returning packet to the correct location.
This was about SNAT and DNAT. We will talk about more such things in this series on networking till then subscribe and stay updated.
Till then you can read about these articles on working on scale