[Asterisk-Users] How to register a SIP phone on Asterisk behind NAT

Kevin Steil kevin at steiltech.com
Thu Jan 12 12:09:42 MST 2006


I currently do this for about 30 different cisco 79xx's connecting to
some hosted Asterisk servers.

Asterisk listens by default for any SIP connection on UDP port 5060.
And will use RTP UDP port 10000 to 20000


The phones use UDP Port 5061 for incoming connections (from Asterisks or
other SIP Devices) and use for RTP, UDP port 10000 to 20000.

Now, if you are going to have the two remote phones at two separate
locations then you can have the firewall forward these ports to the IP
Address of the SIP Phones....not we need to discuss how do you over come
NATing.

I use Cisco phones...so I setup the external IP Address (the address
that the remote phone will appear as) in the Configuration and Turn on
NATing.  This makes the phone use this address in the SIP
communications.  Asterisks has no idea that the phone is being NATed and
has NAT turned off.  

If you have the phones at the same location, then you need to configure
the phone to use different ports for both SIP Communications and RTP.  I
use 5061 for the first phone and then go up from there, 5062 for second
phone.  I then use 10000 to 11999 for RTP for the first phone and 12000
to 13999 for the second phone. The cisco config allows me to enter these
values also in the configuration.  

If you are using some other phones, the you will need to figure out how
to configure them to do the same...basically the phones will send out
packets with the Internet Routable addresses and the port info
configured for them.

Kevin J. Steil
Steil Technologies
  
-----Original Message-----
From: Zeeshan [mailto:zeeshan at acabling.com] 
Sent: Thursday, January 12, 2006 11:46 AM
To: Asterisk User List
Subject: [Asterisk-Users] How to register a SIP phone on Asterisk behind
NAT

Hi everybody,

One of my client's Asterisk box is behind NAT. They have only one public
IP on which they have their router. I can access the Asterisk server
using port forwarding (port 22) for SSH. Now this client wants to
connect two SIP phones to this Asterisk box from two remote locations.
How can this be done. If I forward ports, e.g. 5060-5070 to this
Asterisk box, there is no guarantee that the SIP phones will be using
the same ports from the remote locations, because ports get changed over
the Internet, like for another scenario with my client on public IP,
remote SIP ports are 17355, 61949, 61666 etc., though they are
configured 5060 on the phones, and 5060 in sip.conf.

What is the solution in this scenario of registering SIP on Asterisk
behind NAT?

Thanks,

Zeeshan A Zakaria





More information about the asterisk-users mailing list