View previous topic :: View next topic |
Author |
Message |
barthi Apprentice
Joined: 02 Mar 2003 Posts: 256
|
Posted: Sat Mar 03, 2007 12:21 pm Post subject: Problem mit IPTABLES |
|
|
Hallo!
Bin gerade dabei meinen Server einzurichten.
Lokales Netz ist an eth0.
DSL geht über eth1.
Auf dem Server kann ich ganz normal www.de anpingen, auf den Clients geht aber nichts. Sobald ich dann iptables starte, können die Clients ins Netz, der Server aber nicht mehr.
Hier meine iptables-Rules:
Code: |
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -P FORWARD DROP
iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT
iptables -A FORWARD -i ppp0 -o eth0 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 5555 -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p udp --dport 2049 -j ACCEPT
iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 993 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 443 -j ACCEPT
|
Hab ich irgendwas vergessen oder falsch gemacht?
Bin für jeden Hinweis dankbar.
Danke,
barthi |
|
Back to top |
|
|
Master_Of_Disaster l33t
Joined: 28 Feb 2003 Posts: 610 Location: 15.05072° East, 48.13747° North (aka Mauer), Austria
|
Posted: Sat Mar 03, 2007 2:21 pm Post subject: Re: Problem mit IPTABLES |
|
|
Probiers mal so:
Code: |
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -P FORWARD ACCEPT
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -A OUTPUT -p tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 5555 -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p udp --dport 2049 -j ACCEPT
iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 993 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 443 -j ACCEPT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE |
_________________ post tenebras lux, post fenestras tux
Registered Linux User Nr. 312509
Adopt an unanswered post today! |
|
Back to top |
|
|
barthi Apprentice
Joined: 02 Mar 2003 Posts: 256
|
Posted: Sat Mar 03, 2007 3:21 pm Post subject: |
|
|
Jetzt kann ich nicht mal mehr per ssh auf meinen Server zugreifen.
Wenn ich jetzt einen Ping absetze bekomme ich
Ich versteh das nicht. Auf dem alten Server hat es genau so funktioniert. Warum geht's denn jetzt bei dem nicht mehr???
Habt Ihr vielleicht noch vorschläge?
Danke |
|
Back to top |
|
|
impulze Tux's lil' helper
Joined: 23 Sep 2006 Posts: 82 Location: Taunusstein, Germany
|
Posted: Sat Mar 03, 2007 11:29 pm Post subject: |
|
|
Code: | for chain in `cat /proc/net/ip_tables_names`
do
iptables -t $chain -F
iptables -t $chain -X
done
# Default DROP
iptables -P OUTPUT DROP
iptables -P INPUT DROP
iptables -P FORWARD DROP
# Forward WAN -> LAN and LAN -> WAN
iptables -A FORWARD -i ! ppp0 -o ! ppp0 -j DROP
iptables -A FORWARD -j ACCEPT
# Allow RELATED and ESTABLISHED packets
iptables -N established-related
iptables -A established-related -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -j established-related
iptables -A OUPUT -j established-related
# Allow certain icmp from/to the gateway machine and drop all other icmp
iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type destination-unreachable -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type time-exceeded -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
iptables -A INPUT -p icmp --icmp-type destination-unreachable -j ACCEPT
iptables -A INPUT -p icmp --icmp-type time-exceeded -j ACCEPT
iptables -A INPUT -p icmp -j DROP
iptables -A OUTPUT -p icmp -j DROP
# dein krams
iptables -A OUTPUT -p tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 5555 -j ACCEPT
iptables -A INPUT -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -p udp --dport 2049 -j ACCEPT
iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 993 -j ACCEPT
iptables -A INPUT -i ppp0 -p tcp --dport 443 -j ACCEPT
# NAT
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE |
hoffe hilfreich gewesen zu sein _________________ Please add [SOLVED] to your thread title when the issue no longer exists or has been solved for you. Thank you. |
|
Back to top |
|
|
sschlueter Guru
Joined: 26 Jul 2002 Posts: 578 Location: Dortmund, Germany
|
Posted: Tue Mar 13, 2007 11:15 pm Post subject: |
|
|
Bitte benutzt die Suchfunktion. Es gibt ungefähr 1000000 Threads mit IPTABLES-Anfängerfragen auf forums.gentoo.org.
Bitte postet nicht das Skript, das die Regeln erstellt, sondern die Regeln, die tatsächlich gelten. Wir brauchen mindestens die Ausgaben der Befehle
iptables -t filter -v -L -n
und
iptables -t nat -v -L -n
Allein durch diese Angaben lassen sich einige Probleme bereits direkt lösen, und wenn nicht, dann erspart es zumindest einige sonst notwendige Rückfragen.
Bitte lasst bei Auftreten eines Problems temporär alle verworfenen Pakete loggen. Durch Anschauen der Logs könnt ihr das Problem dann in 80% der Fälle sogar selbst lösen. Wenn nicht, dann kann euch bei Angabe des Regelsatzes und Angabe der Logs zu 100% jemand sagen, wie ihr die Regeln ändern müßt, damit es so funktioniert, wie ihr möchtet.
Fangt mit einem einfachen, funktionierenden Regelsatz an. 95% aller "fertigen" Skripte, die man im Internet finden kann, sind unnötig komplex, fehlerhaft oder beruhen auf fragwürdigen Strategien. Erweitert den einfachen Regelsatz nur, wenn es für die Funktionalität notwendig ist, und wenn, dann erweitert ihn schrittweise und überzeugt euch nach jeder Änderung, dass noch alles funktioniert, was funktionieren soll. |
|
Back to top |
|
|
Master_Of_Disaster l33t
Joined: 28 Feb 2003 Posts: 610 Location: 15.05072° East, 48.13747° North (aka Mauer), Austria
|
|
Back to top |
|
|
slick Bodhisattva
Joined: 20 Apr 2003 Posts: 3495
|
|
Back to top |
|
|
|