SNAT

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen

Grundlegendes

  • Wenn die Quelladresse des ersten Pakets verändert wird, ist das Source NAT
  • Manverändert den Ursprung der Verbindung.
  • Source NAT ist immer Post-Routing-Kette.
  • Es wirkt, gerade bevor das Paket in die Leitung geht.
  • Masquerading ist eine spezielle Form von SNAT.

Schaubilder

Masquerading

SNAT ganzes Netz

Iptables Beispiele

Masquerading

  • iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o $WAN -j MASQUERADE

Natives SNAT

  • iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o $WAN -j SNAT --to 62.54.32.67

SNAT ganzes Netz

  • iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o $WAN -j NETMAP --to 62.54.32.0/24