Differences between SNAT and dnat snat, DNAT, and MASQUERADE are nat masquerade. SNAT is a special case of SNAT. When a data packet is sent from the network adapter, replace the source address in the data packet with the specified IP address, the receiver thinks that the source of the data packet is the IP address of the host. MASQUERADE replaces the source IP address with the IP address on the NIC where the data is sent. Therefore, when the IP address is not fixed, for example, when a dial-up network or IP address is allocated through dhcp, masquerade dnat is used, that is, when a data packet is sent from the NIC, the destination IP address in the data packet is modified, it is shown that if you want to access A, but because the gateway has DNAT, you can change all the destination IP addresses of all data packets accessing A to B, then you actually access B because, the route is selected based on the destination address. Therefore, DNAT is performed on the PREROUTING chain, while SNAT is performed only when data packets are sent. Therefore, it is performed on the POSTROUTING chain.