Anzeige:
Ergebnis 1 bis 8 von 8

Thema: [Routing] Fehler im Routing, einstellungen bei Windows

  1. #1
    so lebendig wie nie :)
    Registriert seit
    Mar 2002
    Beiträge
    2.378

    [Routing] Fehler im Routing, einstellungen bei Windows

    Hallo,

    ich habe auf meinem Windows pc einen UltraVNC laufen.

    mit dieser Config konnte der Betreiber alles sehen aber nichts ändern (maus bewegen etc)



    #!/bin/sh


    rcnamed start


    echo 1 > /proc/sys/net/ipv4/ip_forward


    iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.6.0/16 -j MASQUERADE


    iptables -A FORWARD -i ppp0 -d 192.168.6.0/24 -j ACCEPT


    iptables -A FORWARD -o ppp0 -p TCP --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu


    iptables -t nat -A PREROUTING -i ppp0 -p TCP --dport 4662 -j DNAT --to-destination 192.168.6.2


    iptables -t nat -A PREROUTING -i ppp0 -p UDP --dport 5662 -j DNAT --to-destination 192.168.6.2


    iptables -t nat -A PREROUTING -i ppp0 -p TCP --dport 24500:24505 -j DNAT --to-destination 192.168.6.2
    mit dieser Klappt garnichts mehr.

    #!/bin/bash
    # ---------------------------------------------------------------------
    # Linux-iptables-Firewallskript, Copyright (c) 2004 under the GPL
    # Autogenerated by iptables Generator v1.16 (c) 2002 by Harald Bertram
    # Please visit http://www.harry.homelinux.org for new versions of
    # the iptables Generator (c).
    #
    # This Script was generated by request from:
    # Slimeball@web.de on: 2004-2-17 13:12.44 MET.
    #
    # If you have questions about the iptables Generator or about
    # your Firewall-Skript feel free to take a look at out website or
    # send me an E-Mail to webmaster@harry.homelinux.org.
    #
    # My special thanks are going to Lutz Heinrich (trinitywork@hotmail.com) who
    # made lots of Beta-Testing and gave me lots of well qualified
    # Feedback that made me able to improve the iptables Generator.
    # --------------------------------------------------------------------

    case "$1" in
    start)
    echo "Starte IP-Paketfilter"

    # iptables-Modul
    modprobe ip_tables
    # Connection-Tracking-Module
    modprobe ip_conntrack
    # Das Modul ip_conntrack_irc ist erst bei Kerneln >= 2.4.19 verfuegbar
    modprobe ip_conntrack_irc
    modprobe ip_conntrack_ftp

    # Tabelle flushen
    iptables -F
    iptables -t nat -F
    iptables -t mangle -F
    iptables -X
    iptables -t nat -X
    iptables -t mangle -X

    # Default-Policies setzen
    iptables -P INPUT DROP
    iptables -P OUTPUT DROP
    iptables -P FORWARD DROP

    # MY_REJECT-Chain
    iptables -N MY_REJECT

    # MY_REJECT fuellen
    iptables -A MY_REJECT -p tcp -m limit --limit 7200/h -j LOG --log-prefix "REJECT TCP "
    iptables -A MY_REJECT -p tcp -j REJECT --reject-with tcp-reset
    iptables -A MY_REJECT -p udp -m limit --limit 7200/h -j LOG --log-prefix "REJECT UDP "
    iptables -A MY_REJECT -p udp -j REJECT --reject-with icmp-port-unreachable
    iptables -A MY_REJECT -p icmp -m limit --limit 7200/h -j LOG --log-prefix "DROP ICMP "
    iptables -A MY_REJECT -p icmp -j DROP
    iptables -A MY_REJECT -m limit --limit 7200/h -j LOG --log-prefix "REJECT OTHER "
    iptables -A MY_REJECT -j REJECT --reject-with icmp-proto-unreachable

    # MY_DROP-Chain
    iptables -N MY_DROP
    iptables -A MY_DROP -j DROP

    # Alle Pakete protokollieren
    iptables -A INPUT -j LOG --log-prefix "INPUT LOG "
    iptables -A OUTPUT -j LOG --log-prefix "OUTPUT LOG "
    iptables -A FORWARD -j LOG --log-prefix "FORWARD LOG "

    # Korrupte Pakete zurueckweisen
    iptables -A INPUT -m state --state INVALID -j DROP
    iptables -A OUTPUT -m state --state INVALID -j DROP
    iptables -A FORWARD -m state --state INVALID -j DROP

    # Stealth Scans etc. DROPpen
    # Keine Flags gesetzt
    iptables -A INPUT -p tcp --tcp-flags ALL NONE -j MY_DROP
    iptables -A FORWARD -p tcp --tcp-flags ALL NONE -j MY_DROP

    # SYN und FIN gesetzt
    iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j MY_DROP
    iptables -A FORWARD -p tcp --tcp-flags SYN,FIN SYN,FIN -j MY_DROP

    # SYN und RST gleichzeitig gesetzt
    iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j MY_DROP
    iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN,RST -j MY_DROP

    # FIN und RST gleichzeitig gesetzt
    iptables -A INPUT -p tcp --tcp-flags FIN,RST FIN,RST -j MY_DROP
    iptables -A FORWARD -p tcp --tcp-flags FIN,RST FIN,RST -j MY_DROP

    # FIN ohne ACK
    iptables -A INPUT -p tcp --tcp-flags ACK,FIN FIN -j MY_DROP
    iptables -A FORWARD -p tcp --tcp-flags ACK,FIN FIN -j MY_DROP

    # PSH ohne ACK
    iptables -A INPUT -p tcp --tcp-flags ACK,PSH PSH -j MY_DROP
    iptables -A FORWARD -p tcp --tcp-flags ACK,PSH PSH -j MY_DROP

    # URG ohne ACK
    iptables -A INPUT -p tcp --tcp-flags ACK,URG URG -j MY_DROP
    iptables -A FORWARD -p tcp --tcp-flags ACK,URG URG -j MY_DROP

    # Loopback-Netzwerk-Kommunikation zulassen
    iptables -A INPUT -i lo -j ACCEPT
    iptables -A OUTPUT -o lo -j ACCEPT

    # Maximum Segment Size (MSS) für das Forwarding an PMTU anpassen
    iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

    # Connection-Tracking aktivieren
    iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
    iptables -A FORWARD -i ! ppp0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
    iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
    iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

    # HTTPS
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 443 -j ACCEPT

    # SMTP
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 25 -j ACCEPT

    # POP3S
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 995 -j ACCEPT

    # IMAP
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 143 -j ACCEPT

    # IMAPS
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 993 -j ACCEPT

    # NNTP
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 119 -j ACCEPT

    # DNS
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 53 -j ACCEPT
    iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 53 -j ACCEPT

    # SMB
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 137 -j ACCEPT
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 138 -j ACCEPT
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 139 -j ACCEPT
    iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 137 -j ACCEPT
    iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 138 -j ACCEPT
    iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 139 -j ACCEPT

    # MYSQL
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 3306 -j ACCEPT

    # NTP
    iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 123 -j ACCEPT

    # IRC
    iptables -A INPUT -i ppp0 -m state --state NEW -p tcp --dport 6667 -j ACCEPT

    # IPSEC
    iptables -A INPUT -i ppp0 -p 50 -j ACCEPT
    iptables -A INPUT -i ppp0 -p 51 -j ACCEPT
    iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 500 -j ACCEPT

    # OPENVPN
    iptables -A INPUT -i ppp0 -m state --state NEW -p udp --dport 5000 -j ACCEPT

    # IP-Adresse des LAN-Interfaces ermitteln
    LAN_IP=$(ifconfig eth1 | head -n 2 | tail -n 1 | cut -d: -f2 | cut -d" " -f 1)

    # NAT fuer HTTP
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 80 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 80 -j ACCEPT

    # NAT fuer SSH
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 22 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 22 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 22 -j ACCEPT

    # NAT fuer TELNET
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 23 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 23 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 23 -j ACCEPT

    # NAT fuer FTP
    modprobe ip_nat_ftp
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 21 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 21 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 21 -j ACCEPT

    # NAT fuer HALF-LIFE
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 6000:6003 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 6000:6003 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 6000:6003 -j ACCEPT
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 7001:7002 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 7001:7002 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 7001:7002 -j ACCEPT
    iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 27005 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p udp --dport 27005 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p udp -d 192.168.6.6 --dport 27005 -j ACCEPT
    iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 27010 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p udp --dport 27010 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p udp -d 192.168.6.6 --dport 27010 -j ACCEPT
    iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 27015:27016 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p udp --dport 27015:27016 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p udp -d 192.168.6.6 --dport 27015:27016 -j ACCEPT

    # NAT fuer BZFLAG
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 5155 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 5155 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 5155 -j ACCEPT
    iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 5155 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p udp --dport 5155 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p udp -d 192.168.6.6 --dport 5155 -j ACCEPT
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 5156 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 5156 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 5156 -j ACCEPT
    iptables -t nat -A PREROUTING -i ppp0 -p udp --dport 5156 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p udp --dport 5156 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p udp -d 192.168.6.6 --dport 5156 -j ACCEPT

    # NAT fuer POP3
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 110 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 110 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 110 -j ACCEPT

    # NAT fuer HTTP
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 80 -j SNAT --to-source $LAN_IP
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d --dport 80 -j ACCEPT

    # LAN-Zugriff auf eth1
    iptables -A INPUT -m state --state NEW -i eth1 -j ACCEPT

    # Default-Policies mit REJECT
    iptables -A INPUT -j MY_REJECT
    iptables -A OUTPUT -j MY_REJECT
    iptables -A FORWARD -j MY_REJECT

    # Routing
    echo 1 > /proc/sys/net/ipv4/ip_forward 2> /dev/null

    # Masquerading
    iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

    # SYN-Cookies
    echo 1 > /proc/sys/net/ipv4/tcp_syncookies 2> /dev/null

    # Stop Source-Routing
    for i in /proc/sys/net/ipv4/conf/*; do echo 0 > $i/accept_source_route 2> /dev/null; done

    # Stop Redirecting
    for i in /proc/sys/net/ipv4/conf/*; do echo 0 > $i/accept_redirects 2> /dev/null; done

    # Reverse-Path-Filter
    # Auskommentiert, da IPSEC mit RP_Filter nicht funktioniert!
    # for i in /proc/sys/net/ipv4/conf/*; do echo 2 > $i/rp_filter 2> /dev/null; done

    # Log Martians
    for i in /proc/sys/net/ipv4/conf/*; do echo 1 > $i/log_martians 2> /dev/null; done

    # BOOTP-Relaying ausschalten
    for i in /proc/sys/net/ipv4/conf/*; do echo 0 > $i/bootp_relay 2> /dev/null; done

    # Proxy-ARP ausschalten
    for i in /proc/sys/net/ipv4/conf/*; do echo 0 > $i/proxy_arp 2> /dev/null; done

    # Ungültige ICMP-Antworten ignorieren
    echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses 2> /dev/null

    # ICMP Echo-Broadcasts ignorieren
    echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts 2> /dev/null

    # Max. 500/Sekunde (5/Jiffie) senden
    echo 5 > /proc/sys/net/ipv4/icmp_ratelimit

    # Speicherallozierung und -timing für IP-De/-Fragmentierung
    echo 262144 > /proc/sys/net/ipv4/ipfrag_high_thresh
    echo 196608 > /proc/sys/net/ipv4/ipfrag_low_thresh
    echo 30 > /proc/sys/net/ipv4/ipfrag_time

    # TCP-FIN-Timeout zum Schutz vor DoS-Attacken setzen
    echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout

    # Maximal 3 Antworten auf ein TCP-SYN
    echo 3 > /proc/sys/net/ipv4/tcp_retries1

    # TCP-Pakete maximal 15x wiederholen
    echo 15 > /proc/sys/net/ipv4/tcp_retries2

    ;;

    stop)
    echo "Stoppe IP-Paketfilter"
    # Tabelle flushen
    iptables -F
    iptables -t nat -F
    iptables -t mangle -F
    iptables -X
    iptables -t nat -X
    iptables -t mangle -X
    echo "Deaktiviere IP-Routing"
    echo 0 > /proc/sys/net/ipv4/ip_forward

    # Default-Policies setzen
    iptables -P INPUT ACCEPT
    iptables -P OUTPUT ACCEPT
    iptables -P FORWARD ACCEPT
    ;;

    status)
    echo "Tabelle filter"
    iptables -L -vn
    echo "Tabelle nat"
    iptables -t nat -L -vn
    echo "Tabelle mangle"
    iptables -t mangle -L -vn
    ;;

    *)
    echo "Fehlerhafter Aufruf"
    echo "Syntax: $0 {start|stop|status}"
    exit 1
    ;;

    esac
    weis einer woran das liegen kann ?

  2. #2
    so lebendig wie nie :)
    Registriert seit
    Mar 2002
    Beiträge
    2.378
    Kreative ideen statt lösungen wären auch ganz nett

    mfg sense!

  3. #3
    Moderat0r Avatar von geronet
    Registriert seit
    May 2001
    Ort
    Grainau
    Beiträge
    6.099
    Mit "iptables -vL" kannste mal nachsehen wo die Pakete hängen.
    Nur Puffin verleiht dir die Kraft und Ausdauer die du brauchst!

  4. #4
    so lebendig wie nie :)
    Registriert seit
    Mar 2002
    Beiträge
    2.378
    sense:/home/sense# iptables -vL
    Chain INPUT (policy DROP 0 packets, 0 bytes)
    pkts bytes target prot opt in out source destination
    146K 61M LOG all -- any any anywhere anywhere LOG level warning prefix `INPUT LOG '
    0 0 DROP all -- any any anywhere anywhere state INVALID
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:FIN,SYN/FIN,SYN
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:SYN,RST/SYN,RST
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:FIN,RST/FIN,RST
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:FIN,ACK/FIN
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:PSH,ACK/PSH
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:ACK,URG/URG
    82793 14M ACCEPT all -- lo any anywhere anywhere
    61027 47M ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED
    1 60 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:https
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:smtp
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dptop3s
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:imap2
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:imaps
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:nntp
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:domain
    0 0 ACCEPT udp -- ppp0 any anywhere anywhere state NEW udp dpt:domain
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:netbios-ns
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:netbios-dgm
    150 6872 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:netbios-ssn
    74 5772 ACCEPT udp -- ppp0 any anywhere anywhere state NEW udp dpt:netbios-ns
    0 0 ACCEPT udp -- ppp0 any anywhere anywhere state NEW udp dpt:netbios-dgm
    0 0 ACCEPT udp -- ppp0 any anywhere anywhere state NEW udp dpt:netbios-ssn
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:mysql
    0 0 ACCEPT udp -- ppp0 any anywhere anywhere state NEW udp dpt:ntp
    0 0 ACCEPT tcp -- ppp0 any anywhere anywhere state NEW tcp dpt:ircd
    0 0 ACCEPT esp -- ppp0 any anywhere anywhere
    0 0 ACCEPT ah -- ppp0 any anywhere anywhere
    0 0 ACCEPT udp -- ppp0 any anywhere anywhere state NEW udp dpt:500
    0 0 ACCEPT udp -- ppp0 any anywhere anywhere state NEW udp dpt:5000
    499 75743 ACCEPT all -- eth1 any anywhere anywhere state NEW
    1633 86255 MY_REJECT all -- any any anywhere anywhere

    Chain FORWARD (policy DROP 0 packets, 0 bytes)
    pkts bytes target prot opt in out source destination
    3881 1709K LOG all -- any any anywhere anywhere LOG level warning prefix `FORWARD LOG '
    0 0 DROP all -- any any anywhere anywhere state INVALID
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:FIN,SYN/FIN,SYN
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:SYN,RST/SYN,RST
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:FIN,RST/FIN,RST
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:FIN,ACK/FIN
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:PSH,ACK/PSH
    0 0 MY_DROP tcp -- any any anywhere anywhere tcp flags:ACK,URG/URG
    388 18572 TCPMSS tcp -- any any anywhere anywhere tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
    1885 303K ACCEPT all -- !ppp0 any anywhere anywhere state NEW,RELATED,ESTABLISHED
    1989 1406K ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED
    4 204 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dpt:www
    1 60 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dpt:ssh
    2 120 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dpt:telnet
    0 0 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dpt:ftp
    0 0 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dpts:x11:x11-3
    0 0 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dpts:afs3-callback:afs3-prserver
    0 0 ACCEPT udp -- ppp0 any anywhere 192.168.6.6 state NEW udp dpt:27005
    0 0 ACCEPT udp -- ppp0 any anywhere 192.168.6.6 state NEW udp dpt:27010
    0 0 ACCEPT udp -- ppp0 any anywhere 192.168.6.6 state NEW udp dpts:27015:27016
    0 0 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dpt:5155
    0 0 ACCEPT udp -- ppp0 any anywhere 192.168.6.6 state NEW udp dpt:5155
    0 0 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dpt:5156
    0 0 ACCEPT udp -- ppp0 any anywhere 192.168.6.6 state NEW udp dpt:5156
    0 0 ACCEPT tcp -- ppp0 any anywhere 192.168.6.6 state NEW tcp dptop3
    0 0 MY_REJECT all -- any any anywhere anywhere

    Chain OUTPUT (policy DROP 0 packets, 0 bytes)
    pkts bytes target prot opt in out source destination
    144K 23M LOG all -- any any anywhere anywhere LOG level warning prefix `OUTPUT LOG '
    0 0 DROP all -- any any anywhere anywhere state INVALID
    82793 14M ACCEPT all -- any lo anywhere anywhere
    61295 8336K ACCEPT all -- any any anywhere anywhere state NEW,RELATED,ESTABLISHED
    0 0 MY_REJECT all -- any any anywhere anywhere

    Chain MY_DROP (14 references)
    pkts bytes target prot opt in out source destination
    0 0 DROP all -- any any anywhere anywhere

    Chain MY_REJECT (3 references)
    pkts bytes target prot opt in out source destination
    1564 80624 LOG tcp -- any any anywhere anywhere limit: avg 2/sec burst 5 LOG level warning prefix `REJECT TCP '
    1591 82140 REJECT tcp -- any any anywhere anywhere reject-with tcp-reset
    38 3907 LOG udp -- any any anywhere anywhere limit: avg 2/sec burst 5 LOG level warning prefix `REJECT UDP '
    38 3907 REJECT udp -- any any anywhere anywhere reject-with icmp-port-unreachable
    4 208 LOG icmp -- any any anywhere anywhere limit: avg 2/sec burst 5 LOG level warning prefix `DROP ICMP '
    4 208 DROP icmp -- any any anywhere anywhere
    0 0 LOG all -- any any anywhere anywhere limit: avg 2/sec burst 5 LOG level warning prefix `REJECT OTHER '
    0 0 REJECT all -- any any anywhere anywhere reject-with icmp-proto-unreachable
    sense:/home/sense#
    das sieht in etwa so aus.

    ich denke ich habe irgendwo einen blöden fehler reingesetzt.

  5. #5
    so lebendig wie nie :)
    Registriert seit
    Mar 2002
    Beiträge
    2.378
    Auf dem Router läuft für das Interne Netz ein Apache. (nur darüber erreichbar)

    wenn ich jetzt von ausserhalb auf den router zugreife und der die Port 80 anfrage auf den Rechner dahinter weiterleiten soll. Gibt er ein Connection refused an denjenigen wieder der Anfragen will.

  6. #6
    Moderat0r Avatar von geronet
    Registriert seit
    May 2001
    Ort
    Grainau
    Beiträge
    6.099
    Auf dem Router läuft für das Interne Netz ein Apache. (nur darüber erreichbar)

    wenn ich jetzt von ausserhalb auf den router zugreife und der die Port 80 anfrage auf den Rechner dahinter weiterleiten soll. Gibt er ein Connection refused an denjenigen wieder der Anfragen will.


    Ist ja auch kein Wunder, da du mit der fetten Zeile alle Pakete auf Port 80 von aussen auf 192.168.6.6 forwardest und dann in POSTROUTING in der nächsten Zeile diese Pakete wieder auf den lokalen Stack umleiten willst. Ich bin mir nichtmal sicher ob das überhaupt so funktioniert.. wobei das Connection refused eher vom apache kommt da die IP-Adresse nicht von intern kommt.

    LAN_IP=$(ifconfig eth1 | head -n 2 | tail -n 1 | cut -d: -f2 | cut -d" " -f 1)

    # NAT fuer HTTP
    iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.6.6
    iptables -t nat -A POSTROUTING -o eth1 -p tcp --dport 80 -j SNAT --to-source $LAN_IP

    Im Übrigen ist jedes Portforwarding in diesem Script irgendwie komisch, was soll das SNAT immer dahinter?

    Ich kann mich jetzt nicht mehr genau erinnern aber ich denke mal dass diese Zeile
    iptables -A FORWARD -i ppp0 -m state --state NEW -p tcp -d 192.168.6.6 --dport 80 -j ACCEPT
    gar keinen Sinn ergibt, denn die Port-80 Pakete von aussen werden doch auf 6.6 forwgewardet, laufen die dann noch extra die FORWARD-chain durch?

    PS:
    >146K 61M LOG all -- any any anywhere anywhere LOG level warning prefix `INPUT LOG '
    146000 Pakete? Dein log muss ziemlich voll sein.. das bringts auch nich so.

    Noch'n Tipp:
    >1633 86255 MY_REJECT all -- any any anywhere anywhere
    da sind 1633 Pakete in INPUT gedroppt&geloggt worden, es könnte auch eins von deinen dabei sein, das da verloren ging und nicht hingehört.

    Grüsse, Stefan
    Geändert von geronet (26.02.04 um 20:16 Uhr)
    Nur Puffin verleiht dir die Kraft und Ausdauer die du brauchst!

  7. #7
    so lebendig wie nie :)
    Registriert seit
    Mar 2002
    Beiträge
    2.378
    mmh das schau ich mir lieber morgen Früh an.

    Eigentlich brauche ich ja nur Port 80, 21,20

    mehr ja nicht.

  8. #8
    so lebendig wie nie :)
    Registriert seit
    Mar 2002
    Beiträge
    2.378
    Irgendwie stört der apache, denn jede anfrage auf Port 80 wird von dem geblockt.

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •