FORWARD mit iptables

Post Reply
Message
Author
cliff1984
Posts: 3
Joined: 06. Mar 2007 9:22

FORWARD mit iptables

#1 Post by cliff1984 »

also ich hantier gerade was mit iptables rum

Code: Select all

#eth0 alles erlauben
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A OUTPUT -o eth0 -j ACCEPT

#eth0.2 alles erlauben
iptables -A INPUT -i eth0.4 -j ACCEPT
iptables -A OUTPUT -o eth0.4 -j ACCEPT

#eth0.3 alles erlauben
iptables -A INPUT -i eth0.3 -j ACCEPT
iptables -A OUTPUT -o eth0.3 -j ACCEPT

#eth0.4 alles erlauben
iptables -A INPUT -i eth0.3 -j ACCEPT
iptables -A OUTPUT -o eth0.3 -j ACCEPT

# Squidport für alles was nicht localhost ist sperren !
iptables -A INPUT -m tcp -p tcp -s ! 127.0.0.1 --dport 3128 -j DROP

#iptables -A FORWARD -p all -s 192.168.1.0/24 -d 192.168.6.0/24 -j ACCEPT

iptables -A FORWARD -p icmp -s 0/0 -d 0/0 -j ACCEPT

iptables -A FORWARD -p tcp -s 0/0 -d 0/0 --dport 8080 -j ACCEPT
die auskommentierte FORWARD Regel funktioniert nicht ( also wenn ich sie aktiviere versteht sich :-P ). ich möchte halt aus dem x.x.1.0 netz in das x.x.6.0 netz alles machen dürfen ....

hab ich da nen fehler drinne ??

edit:

hab nun mal folgendes probiert

Code: Select all

iptables -A FORWARD -i eth0.4 -o eth0.3 -p icmp  -j ACCEPT
iptables -A FORWARD -i eth0.3 -o eth0.4 -p icmp  -j ACCEPT
das funzt so auch , nun aber das problem...... von einem netz soll der komplette zugriff auf das andere möglich sein , vom anderen nur der ping ...... wie is das zu realisieren da das eingeschränkte netz ja auf die anfragen des anderen netzes reagieren muss

komsomolze
Posts: 430
Joined: 03. Mar 2006 23:16

#2 Post by komsomolze »

Hallo,

Code: Select all

iptables -A ...
hängt immer AN.

Vor dem FORWARD gibt es PREROUTING, und hinterher POSTROUTING. Im FORWARD gibt es noch MANGLE.

Vielleicht ist vor oder hinter der FORWARD-Anweisung ein Problem?

Code: Select all

iptables -L -nv --line-numbers [-t filter]
iptables -L -nv --line-numbers -t nat
iptables -L -nv --line-numbers -t mangle
Vielleicht eine DROP-Policy?

Forwarding ist aktiviert? (/proc/sys/net/ipv4/ip_forward)
Routing|Gateway ist eingestellt? Entsprechend dann auch auf den Clients?
Wird NAT benötigt? (die Targets SNAT bzw. MASQUERADE in POSTROUTING, DNAT in PREROUTING)

Zur Analyse kannst Du jedem oben ermittelten table eine LOG-Anweisung voranstellen.

Code: Select all

iptables -I ... -j LOG --log-prefix Blabla
Dann ist ein durchlaufendes (bzw. nicht durchlaufendes) Paket zu beobachten.




# Squidport für alles was nicht localhost ist sperren !
iptables -A INPUT -m tcp -p tcp -s ! 127.0.0.1 --dport 3128 -j DROP
dafür wird noch eine LOOP-Regel gebraucht, sonst kann Dir jemand ein Exploit-Paket mit gefälschter 127.0.0.1 schicken, zBsp:

Code: Select all

iptables -I INPUT -d 127.0.0.1/8 -j DROP
iptables -I INPUT -s 127.0.0.1/8 -j DROP
iptables -I INPUT -i lo -j ACCEPT
mfg komsomolze

Post Reply