• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

IP-Sperren?? [gelöst]

Hallo zusammen ich habe da ein kleines Problem...

Ich bin Administrator unseres Wohnheimnetzes... und habe dafür einen SuSe10.0 Netzwerkrouter aufgesetzt.

Es läuft alles Klasse.

Nun zu meinem Problem... Jemand im Netzwerk belastet den Internettraffic erheblich und ich würde das gerne unterbinden...

Also mein erster Gedanke is iptables entsprechend einrichten...

Code:
iptables -A FORWARD -i eth0 -s 192.168.0.81 -o eth1 -j REJECT

denke das der Befehl richtig sein sollte...

Nun ja nur ist das Problem. es passiert einfach nichts... also die IP kann weiterhin durch den Router durch und fleißig surfen...

ergebnis von iptables -L:
Code:
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
input_int  all  --  anywhere             anywhere
input_ext  all  --  anywhere             anywhere
input_ext  all  --  anywhere             anywhere
LOG        all  --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-IN-ILL-TARGET '
DROP       all  --  anywhere             anywhere

Chain FORWARD (policy DROP)
target     prot opt source               destination
TCPMSS     tcp  --  anywhere             anywhere            tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
forward_int  all  --  anywhere             anywhere
forward_ext  all  --  anywhere             anywhere
LOG        all  --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-FWD-ILL-ROUTING '
DROP       all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere            state NEW,RELATED,ESTABLISHED
LOG        all  --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-OUT-ERROR '

Chain forward_ext (1 references)
target     prot opt source               destination
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp echo-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp destination-unreachable
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp time-exceeded
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp parameter-problem
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp timestamp-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp address-mask-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp protocol-unreachable
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp redirect
ACCEPT     all  --  192.168.0.0/24       anywhere            state NEW,RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             192.168.0.0/24      state RELATED,ESTABLISHED
LOG        tcp  --  anywhere             anywhere            limit: avg 3/min burst 5 tcp flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options ip-options prefix `SFW2-FWDext-DROP-DEFLT '
LOG        icmp --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-FWDext-DROP-DEFLT '
LOG        udp  --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-FWDext-DROP-DEFLT '
LOG        all  --  anywhere             anywhere            limit: avg 3/min burst 5 state INVALID LOG level warning tcp-options ip-options prefix `SFW2-FWDext-DROP-DEFLT-INV '
DROP       all  --  anywhere             anywhere

Chain forward_int (1 references)
target     prot opt source               destination
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp echo-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp destination-unreachable
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp time-exceeded
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp parameter-problem
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp timestamp-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp address-mask-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp protocol-unreachable
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp redirect
ACCEPT     all  --  192.168.0.0/24       anywhere            state NEW,RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             192.168.0.0/24      state RELATED,ESTABLISHED
LOG        tcp  --  anywhere             anywhere            limit: avg 3/min burst 5 tcp flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options ip-options prefix `SFW2-FWDint-DROP-DEFLT '
LOG        icmp --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-FWDint-DROP-DEFLT '
LOG        udp  --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-FWDint-DROP-DEFLT '
LOG        all  --  anywhere             anywhere            limit: avg 3/min burst 5 state INVALID LOG level warning tcp-options ip-options prefix `SFW2-FWDint-DROP-DEFLT-INV '
DROP       all  --  anywhere             anywhere

Chain input_ext (2 references)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere            PKTTYPE = broadcast udp dpt:netbios-ns
ACCEPT     udp  --  anywhere             anywhere            PKTTYPE = broadcast udp dpt:netbios-dgm
DROP       all  --  anywhere             anywhere            PKTTYPE = broadcast
ACCEPT     icmp --  anywhere             anywhere            icmp source-quench
ACCEPT     icmp --  anywhere             anywhere            icmp echo-request
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp echo-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp destination-unreachable
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp time-exceeded
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp parameter-problem
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp timestamp-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp address-mask-reply
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp protocol-unreachable
ACCEPT     icmp --  anywhere             anywhere            state RELATED,ESTABLISHED icmp redirect
LOG        all  --  192.168.0.0/24       anywhere            limit: avg 3/min burst 5 state NEW LOG level warning tcp-options ip-options prefix `SFW2-INext-ACC-TRUST '
ACCEPT     all  --  192.168.0.0/24       anywhere            state NEW,RELATED,ESTABLISHED
LOG        tcp  --  anywhere             anywhere            limit: avg 3/min burst 5 tcp dpt:epmap flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options ip-options prefix `SFW2-INext-ACC-TCP '
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:epmap
LOG        tcp  --  anywhere             anywhere            limit: avg 3/min burst 5 tcp dpt:microsoft-ds flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options ip-options prefix `SFW2-INext-ACC-TCP '
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:microsoft-ds
LOG        tcp  --  anywhere             anywhere            limit: avg 3/min burst 5 tcp dpt:netbios-ssn flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options ip-options prefix `SFW2-INext-ACC-TCP '
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:netbios-ssn
LOG        tcp  --  anywhere             anywhere            limit: avg 3/min burst 5 tcp dpt:ssh flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options ip-options prefix `SFW2-INext-ACC-TCP '
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ssh
ACCEPT     udp  --  anywhere             anywhere            udp dpt:netbios-dgm
ACCEPT     udp  --  anywhere             anywhere            udp dpt:netbios-ns
reject_func  tcp  --  anywhere             anywhere            tcp dpt:ident state NEW
LOG        tcp  --  anywhere             anywhere            limit: avg 3/min burst 5 tcp flags:FIN,SYN,RST,ACK/SYN LOG level warning tcp-options ip-options prefix `SFW2-INext-DROP-DEFLT '
LOG        icmp --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-INext-DROP-DEFLT '
LOG        udp  --  anywhere             anywhere            limit: avg 3/min burst 5 LOG level warning tcp-options ip-options prefix `SFW2-INext-DROP-DEFLT '
LOG        all  --  anywhere             anywhere            limit: avg 3/min burst 5 state INVALID LOG level warning tcp-options ip-options prefix `SFW2-INext-DROP-DEFLT-INV '
DROP       all  --  anywhere             anywhere

Chain input_int (1 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere

Chain reject_func (1 references)
target     prot opt source               destination
REJECT     tcp  --  anywhere             anywhere            reject-with tcp-reset
REJECT     udp  --  anywhere             anywhere            reject-with icmp-port-unreachable
REJECT     all  --  anywhere             anywhere            reject-with icmp-proto-unreachable


erstens weiß ich nicht warum so viel da drin steht...???
und zweitens finde ich den eintrag den ich mit dem Befehl gemacht habe nicht...

also ich habe gemacht...
Code:
iptables -F
um Die Iptables zu löschen und habe dann den oben genannte Befehl eingegeben...
danach...
Code:
iptables -t nat -A POSTROUTING -j MASQUERADE
rcnetwork restart

in anderer Reihenfolge hab ich es auch schon versucht und auch keinen Erfolg gehabt...

Hoffe es kann mir jemand bei der Lösung des Problems helfen:)

Vielleicht hat jemand von euch ja auch ne IDEE wie ich die Macadresse sperren kann, damit der Übeltäter nich einfach die IP wechseln kann

Schonmal danke an alle die sich dem Problem annehmen

greets Stinger

Ps.: das Netzwerk liegt an eth1 mit 192.168.0.0/24 und an eth0 hängt ein HW-Router im 192.168.23.0/24er Netz
 

nbkr

Guru
Die erste Regel die iptables findet zählt. Wenn Du also ein ACCEPT (evtl. für das ganze Netz) vor dem Drop hast funktionierts nicht.
 

Martin Breidenbach

Ultimate Guru
Der iptables Befehl sollte so funktionieren... allerdings muß der natürlich an der richtigen Stelle im Firewallskript stehen. Wenn in der Chain vor ihm ein Befehl steht der den betreffenden PC bereits durchläßt dann ist die Zeile wirkungslos.

Benutzt ihr SuSEFirewall2 oder ein selbstgestricktes Firewallskript ?
 
Ich benutze bei dem was dort steht FIREWALL2... nur blicke ich da halt durch die IPTABLES nicht ganz durch.

hab dann auch mal FIREWALL2 abgeschaltet und eigene IPTABLES konfiguriert...

die sahen dann so aus:

Code:
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  192.168.23.0/24      anywhere
ACCEPT     all  --  192.168.0.0/24       anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  192.168.0.81         anywhere            reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             192.168.23.0/24
ACCEPT     all  --  anywhere             192.168.0.0/24

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  192.168.23.0/24      anywhere
ACCEPT     all  --  192.168.0.0/24       anywhere

nur bekomme ich dann vom 192.168.0.0/24er Netz keine Verbindung ins Internet...
hab ich vielleicht einen Befehl vergessen...?

mir wäre es auf jeden Fall auch lieber wenn ich die IPTABLES selbst erstelle denn dann wird das ganze übersichtlicher...

Ich brauche auch keine große Firewallsicherheit da eine Firewall im HW-Router vorhanden ist und eigentlich jeder CLIENT selbst eine Firewall laufen hat.
Damit kamen wir auch ganz gut zurecht d.h. hatten keine Angriffe oder so.
Es soll quasi alles erlaubt sein nur ich möchte einzelnen IP's bzw eventuell Macadressen wenn möglich den Zugriff zum Internet verbieten.

Danke schon mal für die schnellen Antworten
 
Hab das Problem gelöst...

hab die Firewall mit Yast abgeschlatet und dann

Code:
echo 1 > /proc/sys/net/ipv4/ip_forward 2> /dev/null
um das Routing zu starten!

Code:
iptables -t nat -A POSTROUTING -j MASQUERADE
damit aktiviere ich das Masquerading

und zu guterletzt:
Code:
iptables -A FORWARD -i eth1 -s 192.168.0.81 -o eth0 -j REJECT
um die IP zu blocken

Danke für die Hilfe :)
 
Oben