PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : iptables (weiterleitung auf webserver)



chummer
30.05.03, 16:54
hilfe. ;-)
ich hab ein problem mit meinem paketfilter.

und zwar möchte ich das anfragen über den port 80 direkt zu einem anderen rechner im internen netz geleitet werden.

mein skript sieht so aus:

#!/bin/sh

INTERFACE=ppp0
INTERNET=eth1
LAN=eth0
WIN2K=192.168.0.1
ONLINE_IP=`ifconfig ppp0 | grep inet | cut -d: -f2 | cut -d" " -f1`


### alte Regeln werden geloescht. ###
iptables -F
iptables -X allow
iptables -X block


### Forwarding wird aktiviert. ###
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -o ppp0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -o ppp0 -p udp --dport 53 -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

#iptables -A INPUT -j ACCEPT

### eMule Ports werden direkt zur Win2k Kiste weitergeleitet. ###
iptables -t nat -A PREROUTING -i $INTERFACE -p tcp --dport 4661 -j DNAT --to $WIN2K:4661
iptables -t nat -A PREROUTING -i $INTERFACE -p tcp --dport 4662 -j DNAT --to $WIN2K:4662
iptables -t nat -A PREROUTING -i $INTERFACE -p udp --dport 4665 -j DNAT --to $WIN2K:4665
iptables -t nat -A PREROUTING -i $INTERFACE -p udp --dport 4672 -j DNAT --to $WIN2K:4672


### WEB Server wird zur WIN2K Kiste geschaltet ###
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to $WIN2K


### Alle Pakete werden geblockt. ###
iptables -N block
iptables -A block -i $INTERFACE -p tcp --dport 139 -j LOG --log-prefix "Netbios: "
iptables -A block -i $INTERFACE -j LOG --log-prefix "Paket: "
iptables -A block -i $LAN -j LOG --log-prefix "LAN-Paket: "
iptables -A block -j DROP

### Erlaubte Pakete stehen in dieser Tabelle. ###
iptables -N allow
iptables -A allow -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A allow -s 127.0.0.1 -j ACCEPT
iptables -A allow -i $LAN -p icmp -j ACCEPT
iptables -A allow -i $LAN -p tcp --dport 22 -j ACCEPT
iptables -A allow -i $LAN -p tcp --dport 25 -j ACCEPT
iptables -A allow -p udp --dport 53 -j ACCEPT
iptables -A allow -i $LAN -p tcp --sport 80 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A allow -i $LAN -p tcp --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A allow -i $LAN -p tcp --dport 110 -j ACCEPT
iptables -A allow -i $INTERFACE -p tcp --dport 4661 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A allow -i $INTERFACE -p tcp --dport 4662 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A allow -i $INTERFACE -p udp --dport 4665 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A allow -i $INTERFACE -p udp --dport 4672 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

### Alle Pakete durchlaufen zuerst ALLOW und dann BLOCK. ###
iptables -A INPUT -j allow
iptables -A INPUT -j block
iptables -A FORWARD -j allow
iptables -A FORWARD -j block



das komische ist nur das am firewall rechner keine meldung ausgegeben wird wegen port 80. scheint also offen zu sein. und trotzdem kann auf den server nicht zugegriffen werden.