Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to configure asterisk PBX behind my FreeBSD router. To allow other sip clients to call I need to forward ports to my local network asterisk machine. I did it for 5060 and 5061 ports using ipnat and configuring ipnat.rules

rdr fxp0 217.199.MYIP.MYIP/32 port 5061 -> port 5061 udp

But I do not know how I can redirect UDP port range from 60000 to 610000 and also port range UDP Port 10000 - 20000

share|improve this question

With PF, you could do it with variables.

myports = "{ 22 25 2022 2222 8000 }" rdr on $ext_if proto udp from any to $ext_if port $myports ->

...or something.

share|improve this answer
Probably this will work but how then I can fill my variable with 10000 values – adopilot Sep 10 '09 at 9:09
I think you can make a range with a colon, 80:90 would be 80 through 90 for example. It should be in the pf.conf manpage. – Zimmy-DUB-Zongy-Zong-DUBBY Sep 10 '09 at 13:35
up vote 0 down vote accepted

Ill answer in to my question regard to others if will have similar problems

rdr fxp0 217.199.MYIP.MYIP/32 port 60000-61000 -> port 60000 udp

Trick in the minus sing (-) where you can set range of ports,

share|improve this answer
You could also do: rdr fxp0 0/32 port 60000-61000 -> port 60000 udp Wondering though why you want to do this, as this will shovel any connection inbound on fxp0 between 60000 an 61000 to port 60000 on - which I think is your asterisk machine. You would be better off looking for a SIP Proxy to run on your FreeBSD machine that would intelligently open the media ports for your SIP connection - aas that is what you seem to want to be doing here? Have a look at – ColtonCat Sep 11 '09 at 23:48
@ColtonCat I will try to install SER , Yes my asterisk machine is on 1.7 ip address and I did forwarding according to If you can please repeat your comment as an answer so I can accept it as correct, And I if you can give me some basic points how I should configure SIP proxy and which mode to use in SER. Thank you in advance. – adopilot Sep 12 '09 at 7:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.