Iptables mit NAT oder geht's auch anders?

Groening Kay kay.groening at siemens.com
Tue Dec 30 14:11:20 CET 2003


Hallo Jürgen,

das NAT als solches ist nur eine Zeile code.
Also eth0 hängt im Netz vom DSL-Router.
eth1 hat das interne Netz am Haken.

Dann 2 Möglichkeiten:

iptables -t nat -A POSTROUTING -s 10.0.2.x -o eth0 -J MASQUERADE

oder 

iptables -t nat -A POSTROUTING -j SNAT --to-source 10.0.2.x -o eth0

wobei ich Version 2 nehmen würde.
(Version 1 ist mehr für veränderliche IP-Adressen gedacht,
z.B. für ppp-Verbindungen)
An der Stelle von 10.0.2.x kommt für die x die 
reale Adresse deines Rechners rein.

Abspeichern kann man das ganze dann mit 
/etc/init.d/iptables save active.

Viele Grüße

Kay



More information about the Linux mailing list