PF Regeln für VoIP

walschal

Member
Hallo,

bin neuer OpenBSD User und kenne mich leider noch nicht besonders gut aus.
Mein Problem: Versuche seit Tagen einen VoIP Adapter (Grandstream Handytone 486) hinter meinem Router zum Laufen zu bringen, jedoch bislang ohne Erfolg. Eigentlich sollte es mit einem entsprechenden Portforwarding getan sein.

Vielleicht kann sich mal jemand bitte kurz die entsprechenden Stellen für VoIP in meiner pf.conf anschauen, ob das so stimmt. Die anderen Forwardings funktionieren nämlich! Deshalb bin ich am Zweifeln, ob es wirklich am Router liegt.

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 ###

Ext = "tun0"                     # Device an dem das Internet angeschlossen ist 
Int = "xl0"                      # Device an dem das interne Netz haengt
IntNet = "192.168.123.0/24"      # Adressraum des internen Netzes
RouterIP = "192.168.123.250"     # IP Adresse des Routers
Loop = "lo0"                     # Loopback Device
InMuleTCP = "{ 4661, 4662, 8090, 8092 }"
InMuleUDP = "{ 4665, 4672 }"
InVoIPUDP = "{ 3478, 3479, 5004, 5060, 5062, 7077, 7078, 7079, 7080, 7081, 30000, 30001, 30002, 30003, 30004, 30005 }" 
RDP       = "{ 8079 }"

# 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 $Ext

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

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

# Queueing 
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !! Achtung: Der unten stehende Wert von 100Kb (Kilobit) macht natuerlich
# !! nur fuer den Standard DSL Anschluss mit 128kb upstream Sinn. Hat man
# !! eine Verbindung mit groesserer Bandbreite beim upload, dann muss 
# !! dieser Wert entsprechend angepasst werden. 
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
altq on $Ext priq bandwidth 100Kb queue { q_ack, q_pri, q_def, q_idle }
queue q_ack priority 7
queue q_pri priority 6
queue q_def priority 3 priq(default)
queue q_idle priority 1

### NAT & FORWARD ###

# NAT aktivieren (unter Linux als Masquerading bekannt)
nat on $Ext from $IntNet to any -> $Ext 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 RemoteDesktop
rdr on $Ext proto tcp from !$IntNet to any port $RDP        -> 192.168.123.253 

# Erweiterung Forward für eMule
rdr on $Ext proto tcp from !$IntNet to any port $InMuleTCP  -> 192.168.123.253
rdr on $Ext proto udp from !$IntNet to any port $InMuleUDP  -> 192.168.123.253

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

### FILTER ###

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

# Generelle Block Regel
block on $Ext

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

# 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 $Ext inet proto tcp from any to any flags FUP/FUP
block in log quick on $Ext inet proto tcp from any to any flags SF/SFRA
block in log quick on $Ext inet proto tcp from any to any flags /SFRA

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

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

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

# Erweiterung für SSH
pass in quick on $Ext inet proto tcp from any to any port ssh flags S/SAFR keep state label ServiceSSH queue (q_ack, q_pri) 

# Erweiterung für RemoteDesktop
pass in quick on $Ext inet proto tcp from any to any port $RDP flags S/SAFR keep state label ServiceRDP queue (q_ack, q_def) 
 
# Erweiterung für eMule
pass in quick on $Ext inet proto tcp from any to any port $InMuleTCP flags S/SAFR keep state label eMuleTCP queue (q_ack, q_idle)
pass in quick on $Ext inet proto udp from any to any port $InMuleUDP keep state label eMuleUDP queue (q_ack, q_idle)

# Erweiterung für VoIP
pass in quick on $Ext inet proto udp from any to any port $InVoIPUDP keep state label ServiceVoIP queue (q_ack, q_pri) 

# Raus darf (fast) alles
pass out quick on $Ext keep state queue (q_ack, q_def)

Der VoIP-Adapter meldet "detected NAT type is full cone", ist das richtig?
Außerdem sehe ich mit tcpdump "Port 5004 (RTP) unreachable", aber der ist doch geforwarded!

Siehe auch meinen Beitrag im "IP-Phone-Forum.de": http://www.ip-phone-forum.de/forum/viewtopic.php?t=29749

Bin echt um jeden Tip dankbar, da ich absolut nicht mehr weiter weiß!

Vielen Dank!

Gruß Walt
 
Zurück
Oben