Maledictus
FreeBSD ftw
Hallo Leute,
ich hab bisher noch kein Thema und Tutorial zu diesem Thema gefunden, und so dachte ich mir, vielleicht können wir ja was zusammen auf die Beine stellen.
Also, es geht um folgendes:
Ich möchte mit meinem NAT Router, den Traffic managen, der von meinem internen Netz nach draussen geht (und umgekehrt).
Mit managen meine ich so lustige Sachen wie Firewall, Bandbreitenbegrenzung (Traffic Shaping), und bevorzugen von "wichtigen" Paketen (QoS).
Wichtig wäre mir zum Beispiel, das ACK Pakete vor allem anderen Vorrang haben, dann SSH und Online-Spiele, dann erst HTTP, FTP, etc.
Ich will aber für diese Sachen keine feste Bandbreite "reservieren", dann würde etwas verschenkt, wenn SSH mal nicht läuft. (Das ginge auch recht einfach mit pipes.)
Stattdessen will ich "Prioritäten" setzen (gewichten).
Der Aufbau des Systems und der Regeln sollten für viele Leute die gleichen sein, deswegen hoffe ich auf rege mitarbeit
Bei mir siehts so aus:
Internet(DSL) --- FreeBSD NAT Router --- Internes Netz
(kommt euch sicherlich bekannt vor )
Ich hab die "normale" DSL Bandbreite von
748KBit/s Downstream
128KBit/s Upstream
Es fängt natürlich alles beim Kernel an:
options IPFIREWALL
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=300
options DUMMYNET
options HZ=1000
options IPFW2
(unter 4.x muss man vor dem Kernel auch noch ein paar andere Sachen kompilieren,
siehe http://www.bsdforen.de/forums/showthread.php?s=&threadid=148)
Und jetzt hoffe ich auf euch,
lasst uns zusammen die Regeln für ipfw machen, ich habe da schon folgendes zu gefunden:
# High prioriy queues
queue 1 config pipe 10 weight 60
queue 2 config pipe 20 weight 60
# Low priority queues
queue 3 config pipe 10 weight 30
queue 4 config pipe 20 weight 30
queue 5 config pipe 10 weight 10
queue 6 config pipe 20 weight 10
# upstream pipe
pipe 10 config bw 128kbit/s
# downstream pipe
pipe 20 config bw 748kbit/s
# high priority protocols
add 000014 queue 1 tcp from any to any 22,53,80,3389 out xmit fxp0
add 000015 queue 2 tcp from any 22,53,80,3389 to any in recv fxp0
add 000016 queue 1 udp from any to any 53 out xmit fxp0
add 000017 queue 2 udp from any 53 to any in recv fxp0
# low priority protocols
add 000020 queue 3 tcp from any to any 21 out xmit fxp0
add 000021 queue 4 tcp from any 21 to any in recv fxp0
# lowest priority protocols
add 000030 queue 5 tcp from any to any 119,6667,25 out xmit fxp0
add 000031 queue 6 tcp from any 119,6667,25 to any in recv fxp0
Das stimmt natürlich vorne und hinten noch nicht, vor allem das mysteriöse red/gred ist nicht enthalten.
Fragt mich nicht was das ist, ich habs nicht verstanden, wenn jemand das erklären kann, so tue er dies bitte. (vor allem die Parameter)
Ist aber ein guter Ansatz.
Falls jemand schon etwas ähnliches aufgesetzt hat, bitte die Regeln posten (auch Teile).
Bevor ichs vergesse, ich benutze das builtin NAT von ppp, also kann meinetwegen das ganze ohne natd und divert über die Bühne gehen
Für die "normalen" Firewall regeln habe ich folgenden Vorschlag:
00100 allow ip from any to any via lo0
00500 check-state
01000 allow tcp from any to any out setup keep-state
02000 allow udp from any to any out keep-state
03000 allow icmp from any to any icmptypes 3 in
03100 allow icmp from any to any icmptypes 4
03200 allow icmp from any to any icmptypes 8 out
03300 allow icmp from any to any icmptypes 0 in
03400 allow icmp from any to any icmptypes 11 in
65000 allow log ip from any to any
65535 deny ip from any to any
Die Stimmen auch noch nicht, die ersten "any" sollten die IP's und Masken des internen Netzes sein.
Aber funktionieren tun sie auf jeden Fall, wenn auch nur wegen der vorletzten Regel, die ich zu testzwecken drin hab.
So denn, schiesst los, ich hau mich hin, is spät geworden, entschuldigt die länge des Textes, aber ich finde das Ganze recht komplex.
Gute Nacht
Maledictus
ich hab bisher noch kein Thema und Tutorial zu diesem Thema gefunden, und so dachte ich mir, vielleicht können wir ja was zusammen auf die Beine stellen.
Also, es geht um folgendes:
Ich möchte mit meinem NAT Router, den Traffic managen, der von meinem internen Netz nach draussen geht (und umgekehrt).
Mit managen meine ich so lustige Sachen wie Firewall, Bandbreitenbegrenzung (Traffic Shaping), und bevorzugen von "wichtigen" Paketen (QoS).
Wichtig wäre mir zum Beispiel, das ACK Pakete vor allem anderen Vorrang haben, dann SSH und Online-Spiele, dann erst HTTP, FTP, etc.
Ich will aber für diese Sachen keine feste Bandbreite "reservieren", dann würde etwas verschenkt, wenn SSH mal nicht läuft. (Das ginge auch recht einfach mit pipes.)
Stattdessen will ich "Prioritäten" setzen (gewichten).
Der Aufbau des Systems und der Regeln sollten für viele Leute die gleichen sein, deswegen hoffe ich auf rege mitarbeit
Bei mir siehts so aus:
Internet(DSL) --- FreeBSD NAT Router --- Internes Netz
(kommt euch sicherlich bekannt vor )
Ich hab die "normale" DSL Bandbreite von
748KBit/s Downstream
128KBit/s Upstream
Es fängt natürlich alles beim Kernel an:
options IPFIREWALL
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=300
options DUMMYNET
options HZ=1000
options IPFW2
(unter 4.x muss man vor dem Kernel auch noch ein paar andere Sachen kompilieren,
siehe http://www.bsdforen.de/forums/showthread.php?s=&threadid=148)
Und jetzt hoffe ich auf euch,
lasst uns zusammen die Regeln für ipfw machen, ich habe da schon folgendes zu gefunden:
# High prioriy queues
queue 1 config pipe 10 weight 60
queue 2 config pipe 20 weight 60
# Low priority queues
queue 3 config pipe 10 weight 30
queue 4 config pipe 20 weight 30
queue 5 config pipe 10 weight 10
queue 6 config pipe 20 weight 10
# upstream pipe
pipe 10 config bw 128kbit/s
# downstream pipe
pipe 20 config bw 748kbit/s
# high priority protocols
add 000014 queue 1 tcp from any to any 22,53,80,3389 out xmit fxp0
add 000015 queue 2 tcp from any 22,53,80,3389 to any in recv fxp0
add 000016 queue 1 udp from any to any 53 out xmit fxp0
add 000017 queue 2 udp from any 53 to any in recv fxp0
# low priority protocols
add 000020 queue 3 tcp from any to any 21 out xmit fxp0
add 000021 queue 4 tcp from any 21 to any in recv fxp0
# lowest priority protocols
add 000030 queue 5 tcp from any to any 119,6667,25 out xmit fxp0
add 000031 queue 6 tcp from any 119,6667,25 to any in recv fxp0
Das stimmt natürlich vorne und hinten noch nicht, vor allem das mysteriöse red/gred ist nicht enthalten.
Fragt mich nicht was das ist, ich habs nicht verstanden, wenn jemand das erklären kann, so tue er dies bitte. (vor allem die Parameter)
Ist aber ein guter Ansatz.
Falls jemand schon etwas ähnliches aufgesetzt hat, bitte die Regeln posten (auch Teile).
Bevor ichs vergesse, ich benutze das builtin NAT von ppp, also kann meinetwegen das ganze ohne natd und divert über die Bühne gehen
Für die "normalen" Firewall regeln habe ich folgenden Vorschlag:
00100 allow ip from any to any via lo0
00500 check-state
01000 allow tcp from any to any out setup keep-state
02000 allow udp from any to any out keep-state
03000 allow icmp from any to any icmptypes 3 in
03100 allow icmp from any to any icmptypes 4
03200 allow icmp from any to any icmptypes 8 out
03300 allow icmp from any to any icmptypes 0 in
03400 allow icmp from any to any icmptypes 11 in
65000 allow log ip from any to any
65535 deny ip from any to any
Die Stimmen auch noch nicht, die ersten "any" sollten die IP's und Masken des internen Netzes sein.
Aber funktionieren tun sie auf jeden Fall, wenn auch nur wegen der vorletzten Regel, die ich zu testzwecken drin hab.
So denn, schiesst los, ich hau mich hin, is spät geworden, entschuldigt die länge des Textes, aber ich finde das Ganze recht komplex.
Gute Nacht
Maledictus