Skip to main content

How SNAT and DNAT Functioning over the Iptables?

More
18 years 7 months ago #14152 by Nimmy
Dear Friends,

Can any one give simple example of how SNAT and DNAT Working.

And what are the situations this two NAT techniques will be used?



Thanks and Regards,
Nimmy

Nirmal Babu
Chennai
More
18 years 7 months ago #14167 by nske
Hi & welcome Nimmy :)

SNAT (source nat) works by changing the source address field on the IP header, so that the packets appear to be coming from elsewhere (and the answers will be sent there). Most commonly, SNAT is used to allow hosts of an internal network, without routable address, to connect to the outside through the NAT gateway. Like said, the nat gateway will replace the private address with a public address (that routes to him), right before he sends the packets. Then he will forward any replies to the host.

DNAT (destination nat) does the opposite instead. It changes the destination address field on the IP header, so that the packets are forwarded somewhere else than their original destination. Most commonly DNAT is used to allow incoming connections to hosts with no routeble address (known as Port Forwarding) or for security & performance purposes -like to pass the packets through some application-layer filtering proxy or to implement load balancing.

For more on the concept, make sure you check the "Networking -> Network Address Translation" tutorial on this site -just don't let yourself confuse S(ource)NAT/D(estination)NAT with S(tatic)NAT/D(ynamic)NAT.

For a couple of simple examples using IPtables syntax, check the official NAT howto here .
More
18 years 7 months ago #14196 by Nimmy
Dear Nske,

Thank You Very Much.

I have read the documents which u specified. Really Good. Thank a lots. :)



With Regards,
Nimmy

Nirmal Babu
Chennai
Time to create page: 0.125 seconds