Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem mit IPTABLES
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
barthi
Apprentice
Apprentice


Joined: 02 Mar 2003
Posts: 256

PostPosted: Sat Mar 03, 2007 12:21 pm    Post subject: Problem mit IPTABLES Reply with quote

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
View user's profile Send private message
Master_Of_Disaster
l33t
l33t


Joined: 28 Feb 2003
Posts: 610
Location: 15.05072° East, 48.13747° North (aka Mauer), Austria

PostPosted: Sat Mar 03, 2007 2:21 pm    Post subject: Re: Problem mit IPTABLES Reply with quote

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
View user's profile Send private message
barthi
Apprentice
Apprentice


Joined: 02 Mar 2003
Posts: 256

PostPosted: Sat Mar 03, 2007 3:21 pm    Post subject: Reply with quote

Jetzt kann ich nicht mal mehr per ssh auf meinen Server zugreifen.

Wenn ich jetzt einen Ping absetze bekomme ich
Code:

unknown host


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
View user's profile Send private message
impulze
Tux's lil' helper
Tux's lil' helper


Joined: 23 Sep 2006
Posts: 82
Location: Taunusstein, Germany

PostPosted: Sat Mar 03, 2007 11:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
sschlueter
Guru
Guru


Joined: 26 Jul 2002
Posts: 578
Location: Dortmund, Germany

PostPosted: Tue Mar 13, 2007 11:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
Master_Of_Disaster
l33t
l33t


Joined: 28 Feb 2003
Posts: 610
Location: 15.05072° East, 48.13747° North (aka Mauer), Austria

PostPosted: Wed Mar 14, 2007 11:03 am    Post subject: Reply with quote

und wieso kompliziert, wenns auch einfacher geht: -> shorewall
_________________
post tenebras lux, post fenestras tux
Registered Linux User Nr. 312509
Adopt an unanswered post today!
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Wed Mar 14, 2007 3:03 pm    Post subject: Reply with quote

sschlueter wrote:
Es gibt ungefähr 1000000 Threads mit IPTABLES-Anfängerfragen auf forums.gentoo.org.


Auch seih an dieser Stelle auf die gute Doku verwiesen:

http://www.gentoo.org/doc/de/home-router-howto.xml#doc_chap6 (de)
http://www.gentoo.org/doc/en/home-router-howto.xml#doc_chap6 (en)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum