[Ilugc] Iptables

  • From: rengith.thomas@xxxxxxxxx (Ren Thom)
  • Date: Thu May 19 15:08:34 2005

Hi Veera,
                            
      There are 2 type Of NAT(Newtwork Adress Translation)
               1.SNAT(Source NAT)
               2.DNAT(Destination NAT)
      
   Source NAT is when you alter the source address of the first packet:
  i.e. you are changing where the connection is coming from.  Source NAT
  is always done POSTROUTING, just before the packet goes out onto the
  wire.  Masquerading is a specialized form of SNAT.
         For example 
                         Any Packet coming form your  internal
netwwork(192.168.0.x) comes to your  firewall box , where the source
address of each packet can be changed according to the rules specified
in the NAT tables.When the packet leaves the box its source address
will be changed to new one.
 
  Destination NAT is when you alter the destination address of the first
  packet: i.e. you are changing where the connection is going to.
  Destination NAT is always done before routing, when the packet first
  comes off the wire.  Port forwarding, load sharing, and transparent
  proxying are all forms of DNAT.DNAT is always done with PREROUTING

eg         iptables -t nat -A PREROUTING -i eth0 -j DNAT --to 10.1.1.1
              (Change destination addresses to 10.1.1.1)
Any packet coming to   your interface "eth0"  will be routed to another 10.1.1.1

Regrads
Rengith Thomas

Other related posts: