[Gelöst] DD-WRT und IP-Whitelisting

Post new topic   Reply to topic    DD-WRT Forum Index -> Allgemeine Fragen
Author Message
el_pimo
DD-WRT Novice


Joined: 06 Sep 2011
Posts: 14

PostPosted: Thu May 24, 2012 19:25    Post subject: [Gelöst] DD-WRT und IP-Whitelisting Reply with quote
Hallo liebe Community!

Ich hab diese Frage bereits bei Administrator.de gestellt aber glaube hier finde ich eher einen richtigen Ansprechpartner.

Ich habe derzeit ein kleines Projekt laufen in dem ich gerne einen Router mit DD-WRT Software als Hardware-Firewall benutzen möchte. Derzeit übernimmt diese Aufgabe noch eine Linux-Box die ich mit Hilfe von iptables konfiguriert habe. Da mir die aber zu viel Strom verbraucht möchte ich das ganze nun mit einem umgerüsteten Router realisieren.

Kurz zur Erklärung: Ich nutze ein "öffentliches" LAN um meine Internetverbindung im Haus zu verteilen. Jetzt möchte ich aber nicht, das jeder der Zugang zu dem LAN hat, auch gleichzeitig ins Netz kann. Da ich nicht absehen kann, wer alles mit dran hängt, will ich anstelle einer Blacklist (was mit DD-WRT ein Kinderspiel ist) eine Whitelist erstellen, auf der nur mein PC auftaucht.

Unter Linux was das ein Klacks. Einfach die Policies soweit geändert, dass sie jeden aussperren und dann eine Ausnahme hinzugefügt.

Ich dachte, das ließe sich analog auf die iptables von DD-WRT übertragen.

Aktueller stand der Dinge ist: Ich kann alle aussperren, aber die Ausnahme für mich selbst funktioniert nicht so wie gewollt. Ich komme mit der Vordefinierten IP in die Routerkonfiguration, aber nicht darüber hinaus, also ins Internet.

Die Konfiguration sieht aktuell so aus:

PC (10.11.11.2 / 255.255.0.0.)
|
FirewallRouter (10.11.11.1 / 255.255.0.0)
|
InternetRouter (192.168.2.1 / 255.255.255.0) -> ISP

Der FirewallRouter ist über seien WAN Port (192.168.2.8 / 255.255.255.0) mit dem Internetrouter verbunden. Ohne weitere Firewall-Einstellungen ist ein Internetzugriff ohne weiteres möglich, doch sobald ich Versuche alle Fremd-Rechner auszufiltern hänge ich auf dem Router fest und komme nicht weiter hinaus.


Der letzte Stand der iptables Konfiguration (im Netz gefunden und abgewandelt) die ich ausprobiert habe lautet:

Code:
# flush all tables
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
iptables -t security -F
iptables -t raw -F

# policies for filter table
iptables -t filter -P INPUT DROP
iptables -t filter -P OUTPUT DROP
iptables -t filter -P FORWARD DROP
iptables -t nat -P INPUT DROP
iptables -t nat -P OUTPUT DROP
iptables -t nat -P FORWARD DROP
iptables -t filter -A INPUT -s 0.0.0.0/0 -d 10.11.11.2 -j ACCEPT
iptables -t filter -A OUTPUT -s 0.0.0.0/0 -d 10.11.11.2 -j ACCEPT
iptables -t filter -A FORWARD -s 0.0.0.0/0 -d 10.11.11.2 -j ACCEPT
iptables -t filter -A INPUT -s 10.11.11.2 -d 0.0.0.0/0 -j ACCEPT
iptables -t filter -A OUTPUT -s 10.11.11.2 -d 0.0.0.0/0 -j ACCEPT
iptables -t filter -A FORWARD -s 10.11.11.2 -d 0.0.0.0/0 -j ACCEPT
iptables -t nat -A INPUT -s 0.0.0.0/0 -d 10.11.11.2 -j ACCEPT
iptables -t nat -A OUTPUT -s 0.0.0.0/0 -d 10.11.11.2 -j ACCEPT
iptables -t nat -A FORWARD -s 0.0.0.0/0 -d 10.11.11.2 -j ACCEPT
iptables -t nat -A INPUT -s 10.11.11.2 -d 0.0.0.0/0 -j ACCEPT
iptables -t nat -A OUTPUT -s 10.11.11.2 -d 0.0.0.0/0 -j ACCEPT
iptables -t nat -A FORWARD -s 10.11.11.2 -d 0.0.0.0/0 -j ACCEPT


Ich hatte schon kürzere iptables-skripte aber ich habe gehofft, je genauer ich definiere, desto eher kriege ich eine funktionierende Konfiguration hin. Deshalb ist das so lang geworden ;D

Warscheinlich hängt es nur an irgendeiner Kleinigkeit die ich übersehe, aber ich wäre für einen konkreten Tipp sehr dankbar. (Und bitte keine links zur iptables Doku, ich hab heute den ganzen Tag die verschiedensten Foren und Suchmaschienen gewälzt, aber alles was ich gefunden habe sind möglichkeiten wie man Webseiten whitelistet oder andere Leute die das gleiche Problem haben wie ich.)

Danke fürs lesen und die eventuelle Antwort.

mfg elpimo


Last edited by el_pimo on Mon May 28, 2012 18:55; edited 1 time in total
Sponsor
Sash
DD-WRT Guru


Joined: 20 Sep 2006
Posts: 17619
Location: Hesse/Germany

PostPosted: Sat May 26, 2012 18:48    Post subject: Reply with quote
hehehehe...ich hab mich beim lesen erstmal gefragt wo der fehler ist aber dann doch koestlich amousiert.
das laedst du so aus nem script in die firewall?
dann schau dir mal den abauf an...da wird dir was auffallen.






tip: iptables durchlaueft jede rule von oben nach unten bis er den ersten match einer rule hat....

_________________
Forum Guidelines...How to get help
&
Forum Rules
&
RTFM/STFW
&
Throw some buzzwords into the WIKI search Exclamation
_________________
I'm NOT rude, just offer pure facts!
_________________
Atheros (TP-Link & Clones, etc ) debrick service in EU
_________________
Guide on HowTo be Safe, Secure and Protect Your Online Anonymity!
el_pimo
DD-WRT Novice


Joined: 06 Sep 2011
Posts: 14

PostPosted: Mon May 28, 2012 13:12    Post subject: Reply with quote
Spielst du darauf an, dass ich die FORWARD-Rules in der Reihenfolge zuerst einfügen muss?

edit:

Habs gelöst...

Code:
iptables -F
iptables -A FORWARD -d 10.11.11.2 -j ACCEPT
iptables -A FORWARD -s 10.11.11.2 -j ACCEPT
iptables -A INPUT -d 10.11.11.2 -j ACCEPT
iptables -A INPUT -s 10.11.11.2 -j ACCEPT
iptables -A OUTPUT -d 10.11.11.2 -j ACCEPT
iptables -A OUTPUT -s 10.11.11.2 -j ACCEPT
iptables -P FORWARD DROP
iptables -P INPUT DROP
iptables -P OUT DROP


ins FW-Script und schon klappts so wie es soll.
Sash
DD-WRT Guru


Joined: 20 Sep 2006
Posts: 17619
Location: Hesse/Germany

PostPosted: Mon May 28, 2012 20:07    Post subject: Reply with quote
rischdisch!
wenn ich dirs vorgekaut haette waer der lerneffekt net so schoen gewesen. ich nehm an du hast dir dann auch an kopf gefasst ...
Wink

jetzt wuerd ich das regelnwerk nur noch etwas einstampfen und nur das noetigste nutzen.

_________________
Forum Guidelines...How to get help
&
Forum Rules
&
RTFM/STFW
&
Throw some buzzwords into the WIKI search Exclamation
_________________
I'm NOT rude, just offer pure facts!
_________________
Atheros (TP-Link & Clones, etc ) debrick service in EU
_________________
Guide on HowTo be Safe, Secure and Protect Your Online Anonymity!
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Allgemeine Fragen All times are GMT

Navigation

 
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
You can attach files in this forum
You can download files in this forum