Willkürliches Routing über IP-Alias

Prymaxx

Member
Hallo zusammen.

Hab mal wieder ein merkwürdiges Phänomen zu dem mir vielleicht jemand einen Tipp geben kann.

Ich habe seit heute einen Voice-over-IP Adapter im Netz hängen. Um das Gerät vernünftig zum Laufen zu bekommen musste ich in der pf.conf eine binat Regel für ein 1:1 Mapping zwischen externem Interface (rl2) und VoIP-Adapter einfügen.
Dafür habe ich auf rl2 (192.168.10.254) einen Alias-Eintrag (192.168.10.244) angelegt.
Das Mapping zwischen rl2 und VoIP-Adapter scheint zu funktioniert, allerdings bekommen Datenpakete die aus dem restlichen internen Netz über rl2 genattet werden nicht mehr die .10.254, sondern die .10.244 als Source Address aufgedrückt.
Das hat zur Folge, dass die Antwort-Pakete teilweise an den VoIP-Adapter geschickt werden, der damit ja nun garnichts anfangen kann.
Wobei... so ganz korrekt ist das auch nicht. Ich habe das Gefühl dass die Source Address recht willkürlich gewählt wird :confused:
Internetseiten kann ich aufrufen, aber pfctl -s state schmeisst mir recht seltsame Meldungen an den Kopf:
Code:
tcp 10.10.0.4:3406 -> 192.168.10.244:60287 -> 12.155.170.10:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3404 -> 192.168.10.244:64655 -> 12.155.170.10:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3407 -> 192.168.10.254:63869 -> 168.143.100.11:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3398 -> 192.168.10.244:51128 -> 66.98.209.15:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3399 -> 192.168.10.254:63851 -> 66.98.209.15:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:4662 <- 192.168.10.244:4662 <- 217.80.142.46:4557       ESTABLISHED:ESTABLISHED
tcp 10.10.0.4:3392 -> 192.168.10.244:56736 -> 66.98.208.62:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3394 -> 192.168.10.244:57083 -> 66.98.208.62:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3421 -> 192.168.10.244:50635 -> 212.72.38.71:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3422 -> 192.168.10.254:62251 -> 212.72.38.71:80       FIN_WAIT_2:FIN_WAIT_2
tcp 10.10.0.4:3417 -> 192.168.10.244:54781 -> 212.204.60.79:80       ESTABLISHED:ESTABLISHED
tcp 10.10.0.4:3418 -> 192.168.10.254:55784 -> 212.204.60.79:80       ESTABLISHED:ESTABLISHED
tcp 10.10.0.4:1909 -> 192.168.10.254:59099 -> 80.144.157.80:4662       ESTABLISHED:ESTABLISHED
tcp 10.10.0.4:3419 -> 192.168.10.244:65519 -> 212.204.49.83:80       FIN_WAIT_2:FIN_WAIT_2
tcp 10.10.0.4:4662 <- 192.168.10.254:4662 <- 217.81.48.88:21118       ESTABLISHED:ESTABLISHED
tcp 10.10.0.4:3367 -> 192.168.10.254:57036 -> 216.239.59.104:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3412 -> 192.168.10.244:57776 -> 207.46.130.112:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3413 -> 192.168.10.254:62010 -> 207.46.130.112:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3402 -> 192.168.10.244:53682 -> 81.22.33.115:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3395 -> 192.168.10.254:58622 -> 81.22.33.115:80       TIME_WAIT:TIME_WAIT
tcp 10.10.0.4:3382 -> 192.168.10.244:51070 -> 213.148.129.136:80       TIME_WAIT:TIME_WAIT

Weiss jemand ob es eine Möglichkeit gibt rl2 klarzumachen, für alles was sich nicht auf die entsprechende binat Regel bezieht grundsätzlich die reguläre IP-Adresse und nicht die Alias-Adresse als Absender-Adresse zu benutzen?
Ich hab die letzten Stunden schon das halbe Internet durchforstet, aber es ist nahezu unmöglich brauchbare Suchergebnisse zu bekommen, wenn man nicht mal genau weiss wonach man suchen soll.
Meine OpenBSD Kenntnisse sind immer noch recht dürftig und ich bin für jeden Tipp dankbar.

Der vollständigkeithalber hier nochmal meine aktuelle pf.conf:
Code:
#Macros
int_if = "rl0"
vm_if = "rl1"
ext_if = "rl2"
#guest_if = "rl3"
loopback = "lo0"

#Inbound ports
tcp_services = "{ 25, 110, 21, 80, 4662, 2000, 6112, 10000, 2047, 6699, 24499><24506, 24509><24516 }"
udp_services = "{ 4672, 6257 }"

#Outbound ports (queueing)
voip_ports = "{ 5004, 5060, 10000 }"
emule_ports = "{ 4662 }"

icmp_types = "echoreq"

set block-policy return
set loginterface $ext_if

scrub in on $ext_if all

# Queueing
altq on $ext_if priq bandwidth 230Kb queue { tcp_ack_out, voip_out, dns_out, std_out, emule_out }
queue tcp_ack_out priority 7
queue voip_out priority 6
queue dns_out priority 5
queue std_out priority 3 priq(default)
queue emule_out priority 1 priq(ecn)

nat on $ext_if from $int_if:network to any -> $ext_if
nat on $ext_if from $vm_if:network to any -> $ext_if
#nat on $ext_if from $guest_if:network to any -> $ext_if

# VoIP 1:1 Mapping
binat on $ext_if from 192.168.5.100 to any -> 192.168.10.244

#Redirect (FTP-Proxy)
rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021
#rdr on $guest_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021

#Redirect (Incoming)
#Webmin
rdr on $int_if proto tcp from any to any port 9999 -> 127.0.0.1 port 10000
rdr on $int_if proto tcp from any to any port 9998 -> 192.168.5.200 port 10000
#CUBE Apache
rdr on $ext_if proto tcp from any to any port 80 -> 10.10.0.2 port 80
#CUBE FTP
rdr on $ext_if proto tcp from any to any port 21 -> 10.10.0.2 port 21
#NB1 eMule
rdr on $ext_if proto tcp from any to any port 4662 -> 10.10.0.4 port 4662
rdr on $ext_if proto udp from any to any port 4672 -> 10.10.0.4 port 4672
#NB1 RemotelyAnywhere
rdr on $ext_if proto tcp from any to any port 2000 -> 10.10.0.4 port 2000
#GISMO Webcam
rdr on $ext_if proto tcp from any to any port 2047 -> 10.10.0.2 port 2047
#GISMO WinMX
rdr on $ext_if proto tcp from any to any port 6699 -> 10.10.0.2 port 6699
rdr on $ext_if proto udp from any to any port 6257 -> 10.10.0.2 port 6257
#GISMO ICQ File Transfer
rdr on $ext_if proto tcp from any to any port 24500:24505 -> 10.10.0.2 port 24500:24505
#NB1 ICQ File Transfer
rdr on $ext_if proto tcp from any to any port 24510:24515 -> 10.10.0.4 port 24510:24515
#NB1 battle.net
rdr on $ext_if proto tcp from any to any port 6112 -> 10.10.0.4 port 6112

#Debug
#pass quick all

#Filter Rules
block all
block quick inet6

pass quick on $loopback all

pass in inet proto icmp all icmp-type $icmp_types keep state
pass out inet proto icmp all icmp-type $icmp_types keep state

#Filter rl0 inbound
pass in quick on $int_if from $int_if:network to any keep state

#Filter rl0 outbound
pass out quick on $int_if from any to $int_if:network keep state

#Filter rl1 inbound
pass in quick on $vm_if from $vm_if:network to any keep state

#Filter rl1 outbound
pass out quick on $vm_if from any to $vm_if:network keep state

#Filter rl3 inbound
#pass in quick on $guest_if from $guest_if:network to any keep state

#Filter rl3 outbound
#pass out quick on $guest_if from any to $guest_if:network keep state

#Filter rl2 inbound
pass in on $ext_if inet proto tcp from any to any  \
   port $tcp_services flags S/SA keep state
pass in on $ext_if inet proto udp from any to any  \
   port $udp_services keep state
pass in on $ext_if inet proto udp from any to any  \
   port $voip_ports keep state

#Filter rl2 outbound
pass out on $ext_if inet proto tcp from $ext_if to any modulate state flags S/SA \
   queue ( std_out, tcp_ack_out )
pass out on $ext_if inet proto { udp, icmp } from $ext_if to any keep state
pass out on $ext_if inet proto { tcp, udp } from $ext_if to any port domain keep state \
   queue dns_out
pass out on $ext_if inet proto udp from $ext_if to any port $voip_ports keep state \
   queue ( voip_out, tcp_ack_out )
pass out on $ext_if inet proto { tcp, udp } from $ext_if to any port $emule_ports keep state \
   queue ( emule_out, tcp_ack_out )

Code:
[Internet]-----[Router 192.168.10.100]----- rl2 [192.168.10.254 OpenBSD 192.168.5.254] rl1 -----[VoIP-Adapter 192.168.5.100]
                                           alias 192.168.10.244    |
                                                                   |
                                                                   |
                                                             [10.10.0.254]
                                                                  rl0
                                                                   |
                                                                   |
                                                            [NB1 10.10.0.4]

Gruss
Benjamin
 
Zuletzt bearbeitet:
Hi,

nennt sich round-robin und ist bei "nat... -> interface" implizit, wenn es
mehrere adressen einer family (hier inet) gibt.

Du kannst nun entweder die nat rule auf die .254 direkt konfigurieren,
oder die rules umstellen (nat/rdr/binat sind 'first match wins'), oder noch
'no nat' rules einbauen.

HTH,
 
Danke, das war der entscheidende Hinweis :)
Ich hab den Alias wieder rausgenommen und für die binat Regel die .10.254 genommen. Jetzt funktioniert alles wieder wie gewohnt.
Aber das binat beisst sich noch irgendwie mit den Filter Regeln.
Wenn ich die pf.conf so lasse wie oben angezeigt, bekomme ich mit dem VoIP-Adapter keine Verbindungen zustande.
Sobald ich die Filter Regeln mit pass quick all umgehe funktioniert es.
Ich hab die Filter Regeln jetzt noch etwas angepasst.
Code:
#Filter rl2 inbound
pass in quick on $ext_if inet proto tcp from any to any  \
   port $tcp_services flags S/SA keep state
pass in quick on $ext_if inet proto udp from any to any  \
   port $udp_services keep state
pass in quick on $ext_if inet proto udp from any to any  \
   port $voip_ports keep state

#Filter rl2 outbound
pass out quick on $ext_if inet proto udp from $ext_if to any port $voip_ports keep state \
   queue ( voip_out )
pass out on $ext_if inet proto tcp from $ext_if to any modulate state flags S/SA \
   queue ( std_out, tcp_ack_out )
pass out on $ext_if inet proto { udp, icmp } from $ext_if to any keep state
pass out on $ext_if inet proto { tcp, udp } from $ext_if to any port domain keep state \
   queue dns_out
#pass out on $ext_if inet proto udp from $ext_if to any port $voip_ports keep state \
   queue ( voip_out, tcp_ack_out )
pass out on $ext_if inet proto { tcp, udp } from $ext_if to any port $emule_ports keep state \
   queue ( emule_out, tcp_ack_out )
VoIP läuft, aber das Queueing scheint nicht in Kraft zu sein :(
Aber irgendwas ist ja immer ;)

Angedacht ist eigentlich, dass, sobald ein Telefonat geführt wird, eMule und andere bandbreitenintensive Anwendungen in den Keller gehen um eine vernünftige Sprachqualität zu gewährleisten.
Mitunter kommt es, wenn eMule läuft, auch vor, dass eingehende Telefonate nicht durchgeleitet werden.
Ich vermute dass das mit den Ports zusammenhängt. Mein Verdacht ist, dass der Esel für Clientverbindungen temporär die VoIP Ports verwendet.
Ich muss mir das nochmal ansehen, aber im Moment kann ich die pf.conf nicht mehr sehen, hab bis heute Morgen davor gesessen und rumprobiert;)

Gruss
Benni
 
Hi,

uebrigens.. die qualitaet fuer sowas wie voip will man
eigentlich eh mit hfsc machen.

aber debug mal, ich hab derzeit keinen platz mehr im kopf, dieses
rule-monster zu analysieren :}
 
Geh mir ähnlich. Hätte ich am Anfang gewusst wie umfangreich das mal wird, ich hätte wahrscheinlich die Finger davon gelassen :D

Aber klär mich mal bitte auf... was ist hfsc? Ich hab mal ´n bischen nach gegoogled, konnte auch was finden, aber das scheint für OpenBSD 3.4 nicht mehr zuzutreffen.

Gruss
Benni
 
Klingt für mich genau wie Class Based Queueing, bis auf die kleinen Zusatzoptionen im Scheduler. Wo machen sich da die Unterschiede bemerkbar?
 
Zuletzt bearbeitet:
Zurück
Oben