Re: Funktionsweise von IP tables
Am Freitag, 29. September 2006 20:07 schrieb Mag. Leonhard Landrock:
> Hallo!
Noch einmal antworte ich mir auch selbst. :-)
> Ich bin langsam etwas genervt. Es geht um folgende Konfiguration:
>
> Rechner "veneto" soll eingehende IP Pakete für Port 25 an den
> Rechner "firewall" und Port 25 weiterleiten. Ich habe folgende
> Konfiguration eingegeben:
>
> <-- Skript beginnt hier -->
>
> #! /bin/bash
>
> ############
> # #
> # IP tables leeren #
> # #
> ############
>
> iptables -t mangle --flush PREROUTING
> iptables -t mangle --flush POSTROUTING
>
> iptables -t nat --flush INPUT
> iptables -t nat --flush OUTPUT
> iptables -t nat --flush FORWARD
>
> iptables -t filter --flush INPUT
> iptables -t filter --flush OUTPUT
> iptables -t filter --flush FORWARD
>
> # Weiterleitung aktivieren
> echo 1 > /proc/sys/net/ipv4/ip_forward
>
> ######
> # #
> # DNAT #
> # #
> ######
>
> # Protocoll TCP
> iptables -t nat --append PREROUTING --protocol tcp --source 192.168.1.0/24
> \ --dport 25 -j DNAT --to-destination 192.168.1.254:25
>
> # Protocol UDP
> iptables -t nat --append PREROUTING --protocol udp --source 192.168.1.0/24
> \ --dport 25 -j DNAT --to-destination 192.168.1.254:25
>
> <-- Skript endet hier -->
>
> Tatsächlich will ich noch ein paar weitere Ports (8080, 21 und 110) mittels
> REDIRECT testen. Aber das ist etwas anderes. :-)
>
> Rechner "veneto" hat die IP 192.168.1.33
> Rechner "firewall" hat die IP 192.168.1.254 und die IP 10.0.0.10
> Rechner "server" hat die IP 192.168.1.3
>
> Wenn ich nun mein Skript am Rechner "veneto" ausführe und dann von
> Rechner "server" ein telnet auf "192.168.1.33" mit Port 25 ausführe, sollte
> doch eigentlich das IP-Paket an Rechner "firewall" und Port 25
> weitergegeben werden. Oder?
>
> 2 Fragen:
>
> 1.) Stimmt meine oben gemachte Annahme?
NEIN (?)
Ich mache DNAT. So weit so gut.
Schaut wie folgt aus:
(1) Anfrage:
SRC-IP: 192.168.1.3
DST-IP: 192.168.1.33
(2) Umleitung:
SRC-IP: 192.168.1.3
DST-IP: 192.168.1.254
(3) Antwort:
SRC-IP: 192.168.1.254
DST-IP: 192.168.1.3
Kann es da irgendein Problem geben? Wird da noch irgendetwas herumgepfuscht?
> 2.) Wie könnte ich diese Annahme überprüfen?
>
> LG,
> Leonhard.
Reply to: