Internetanbindung über 2 DSL-Leitungen, Traffic getrennt nach Protokollen

walschal

Member
Hallo zusammen,

habe folgendes Problem, bei dem ich nicht weiter komme:
Habe für die Internet-Anbindung 2 DSL-Leitungen über pppoe, welche auch einwandfrei laufen. Nun möchte ich den Traffic nach Protokollen separieren und entsprechend über die erste oder die zweite Leitung schicken.
Bsp.: der ganze Saug-Traffic (eMule, etc.) geht über Leitung 2 und "müllt" diese zu. HTTP, FTP, VoIP, etc. soll über die erste Leitung laufen.
Habe hierzu mal eine pf.conf erstellt, die jedoch nicht läuft. Lädt man die Regeln kann man sich nicht mehr per SSH auf den Router connecten, geschweige denn, dass man surfen kann.
Hier meine pf.conf
Code:
#       $OpenBSD: pf.conf,v 1.28 2004/04/29 21:03:09 frantzen Exp $
#
# See pf.conf(5) and /usr/share/pf for syntax and examples.
# Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1
# in /etc/sysctl.conf if packets are to be forwarded between interfaces.
# mit  /sbin/pfctl -e -F all -f /etc/pf.conf neu laden der Regeln

### VARIABLEN ###

Ext1 = "tun0"                    # Device an dem das Internet angeschlossen ist
Ext2 = "tun1"                    # Device an dem das Internet angeschlossen ist
Int = "rl0"                      # Device an dem das interne Netz haengt
IntNet = "192.168.22.0/24"       # Adressraum des internen Netzes
RouterIP = "192.168.22.154"      # IP Adresse des Routers
Loop = "lo0"                     # Loopback Device

# Liste von bekannten Ports:

#                ssh smtp ntp dns http pop ident nntp imap ssl rsync imap3 pop3ssl vpn  msnp icq  irc  http-alt rdp  rdp
StdTCPPorts = "{ 22  25   37  53  80   110 113   119  143  443 873   993   995     1723 1863 5190 6667 8080     3389 8079 }" 

#                smtp pop pop imap imap smtp imap smtp imap pop cvs cvs
StdUDPPorts = "{ 25   109 110 143  220  465  473  587  993  995 2401 2477 }"

#                 vc   vc    vc    cs    cs    cs
GameUDPPorts = "{ 5425 15425 28900 27010 27015 27016 }"

SaugUDPPorts = "{ 411 412 417 1412 4616 4242 5656 8686 6399 4662 5662 6662 7662 8662 4661 5661 6661 7661 8661 4668 5668 6668 7668 8668 }" 

InVoIPUDP = "{ 3478, 3479, 5004, 5060, 5062, 7077, 7078, 7079, 7080, 7081, 30000, 30001, 30002, 30003, 30004, 30005 }"

# Adressen die auf dem externen Device nicht geroutet werden
# (Adressbereich des internen Netzes muss man wegen der Weiterleitungen zulassen)
table <NoRoute> { 127.0.0.1/8, 172.16.0.0/12, 192.168.0.0/16, !$IntNet, 10.0.0.0/8, 255.255.255.255/32 }

### OPTIONS ###

# Macht Statistiken fuer die DSL-Verbindung (pfctl -s info)
set loginterface $Int

# Beendet inaktive Verbindungen schneller - geringerer Speicherverbrauch.
set optimization aggressive

# Fragmentierte Pakete saeubern
scrub on $Ext1 all fragment reassemble random-id
scrub on $Ext2 all fragment reassemble random-id

# Queueing
altq on $Ext1 priq bandwidth 512Kb queue { q_ack1, q_pri1, q_def1, q_idle1 }
queue q_ack1 priority 7
queue q_pri1 priority 6
queue q_def1 priority 3 priq(default)
queue q_idle1 priority 1

altq on $Ext2 priq bandwidth 256Kb queue { q_ack2, q_pri2, q_def2, q_idle2 }
queue q_ack2 priority 7
queue q_pri2 priority 6
queue q_def2 priority 3 priq(default)
queue q_idle2 priority 1


### NAT & FORWARD ###

# NAT aktivieren (unter Linux als Masquerading bekannt)
nat on $Ext1 from $IntNet to any -> $Ext1 static-port
nat on $Ext2 from $IntNet to any -> $Ext2 static-port

# Active FTP - Umleitung zu unserem ftp-proxy
#rdr on $Int proto tcp from !$RouterIP to !$IntNet port 21   -> 127.0.0.1 port 8021

# Erweiterung Forward für VoIP
rdr on $Ext1 proto udp from !$IntNet to any port $InVoIPUDP  -> 192.168.22.11

### FILTER ###

# Zum Debuggen....
#pass quick all             # Alles durchlassen

# Generelle Block Regel
block on $Ext1
block on $Ext2

# Freiwillig machen wir keinen mucks ;)
block return log on $Ext1
block return log on $Ext2

# Wir wollen kein IPv6.0
block quick inet6

# Loopback Device darf alles
pass quick on $Loop

# Erschwert scannen mit nmap und co.
block in log quick on $Ext1 inet proto tcp from any to any flags FUP/FUP
block in log quick on $Ext1 inet proto tcp from any to any flags SF/SFRA
block in log quick on $Ext1 inet proto tcp from any to any flags /SFRA

block in log quick on $Ext2 inet proto tcp from any to any flags FUP/FUP
block in log quick on $Ext2 inet proto tcp from any to any flags SF/SFRA
block in log quick on $Ext2 inet proto tcp from any to any flags /SFRA

# IP Spoofing verhindern
block in log quick on $Ext1 inet from <NoRoute> to any
block in log quick on $Ext1 inet from any to <NoRoute>

block in log quick on $Ext2 inet from <NoRoute> to any
block in log quick on $Ext2 inet from any to <NoRoute>

# Active FTP erlauben
#pass in quick on $Ext1 inet proto tcp from any to any port > 49151 user proxy flags S/SAFR keep state

# Erstmal alles auf Leitung 2 schicken, Spezialisierung nach Leitung 1 folgt danach
pass in on $Int route-to $Ext2 inet proto tcp from $IntNet to any flags S/SAFR keep state
pass in on $Int route-to $Ext2 inet proto udp from $IntNet to any keep state

# "normaler" Verkehr (http...)
pass in on $Int route-to $Ext1 inet proto tcp from $IntNet to any port $StdTCPPorts flags S/SAFR keep state queue (q_ack1, q_def1)
pass in on $Int route-to $Ext1 inet proto udp from $IntNet to any port $StdUDPPorts keep state queue (q_def1)

# "Game" Verkehr
pass in on $Int route-to $Ext1 inet proto udp from $IntNet to any port $GameUDPPorts keep state queue (q_pri1)

# "Saug" Verkehr
pass in on $Int route-to $Ext2 inet proto udp from $IntNet to any port $SaugUDPPorts keep state queue (q_idle2)

# Ping akzeptieren (ablehnen ist uebrigens wenig sinnvoll)
pass in quick on $Ext1 inet proto icmp all icmp-type 8 code 0 keep state queue (q_pri1)
pass in quick on $Ext2 inet proto icmp all icmp-type 8 code 0 keep state queue (q_pri2)

# Erweiterung für SSH
pass in quick on $Ext1 inet proto tcp from any to any port ssh flags S/SAFR keep state queue (q_ack1, q_pri1)

# Erweiterung für VoIP
pass in quick on $Ext1 inet proto udp from any to any port $InVoIPUDP keep state queue (q_pri1)

# Raus darf (fast) alles
pass out quick on $Ext1 keep state queue (q_ack1, q_def1)
pass out quick on $Ext2 keep state queue (q_ack2, q_def2)

Die default-Route hab ich über Leitung 2 gesetzt, siehe ppp.conf:
Code:
default:
 set log Phase Chat IPCP CCP tun command
 set redial 15 0
 set reconnect 15 10000
     
pppoe1:
 set device "!/usr/sbin/pppoe -i rl1"
 disable acfcomp protocomp
 disable ipv6cp
 deny acfcomp
 set mtu max 1492
 set crtscts off
 set speed sync
 enable lqr
 set lqrperiod 5
 set dial
 set login
 set timeout 0
 set authname "abc@mdsl.mnet-online.de"
 set authkey 123 
# add! default HISADDR
 enable dns
 enable mssfixup

pppoe2:
 set device "!/usr/sbin/pppoe -i rl2"
 disable acfcomp protocomp
 disable ipv6cp
 deny acfcomp
 set mtu max 1492
 set crtscts off
 set speed sync
 enable lqr
 set lqrperiod 5
 set dial
 set login
 set timeout 0
 set authname "def@mdsl.mnet-online.de"
 set authkey 456 
 add! default HISADDR
 enable dns
 enable mssfixup

Bin ziemlicher Anfänger, deswegen wäre ich über jeden Tip dankbar!!!

Grüße,
Walt
 
Ich glaub eine freeX im letzten Jahr (4,5 oder 6) hatte das system als Thema. Hab aber grad keine Zeit zu suchen
 
Hiho

Ich sitze an einem ähnlichen Problem. Ich habe allerdings nicht nach einzelnen ports aufgeschlüsselt, sondern wollte mit route to einfach udp icmp http und ssh trennen

Allerding geht das bei mir auch nicht. Noch nicht.

Wäre aber super wenn du eine/deine Lösung dann nochmal posten könntest.

Werd meine Regelsätze auch noch mal hier posten komm nur gerade nicht ran.


BlueMaster
 
muesste das nicht "einfach" so eine regel sein wie

Code:
block out all
pass out on $DSL1 from any to any port=80
pass out on $DSL2 from any to any port=31337

und eine von den beiden karten sollte deine defaultroute darstellen.

ich kann mich dran erinnern mal vor jahren ein aehnliches problem gehabt zu haben. unsere uni hatte in die studentenwohnheime "internet" gelegt.
aber nur port 80 und 21 freigeschaltet. das dann aber auch mit 100mbit/s.
also hab ich meine damalige dsl-leitung behalten.

das war dann aber auch unter linux.
 
Zurück
Oben