[asterisk-bugs] [Asterisk 0013577]: If the source port changes on the router, the peer will become UNREACHABLE

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Nov 13 16:49:10 CST 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13577 
====================================================================== 
Reported By:                ffadaie
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   13577
Category:                   Channels/chan_iax2
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
Asterisk Version:           1.4.21.2 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-09-28 12:56 CDT
Last Modified:              2008-11-13 16:49 CST
====================================================================== 
Summary:                    If the source port changes on the router, the peer
will become UNREACHABLE
Description: 
There are two Asterisk servers. One of them is behind a firewall/NAT and
the other one has a public routable IP address. They both have static
public IP addresses.
Here is what I have on Asterisk one(Asterisk-1) in iax.conf:
[GW2]
type=friend
host=public_ip_address_of_GW2
qualify=yes
context=something

and on the second one [behind the firewall] (Asterisk-2):
[GW1]
type=friend
host=ip_address_of_GW1
qualify=yes
context=something_else

External IAX2 port, 4569, is forwarded to the internal 4569 on the
firewall. They however use dynamic source port overwriting which means if
Asterisk-2 tries to contact Asterisk-1 from 4569 on Asterisk-2 to 4569 on
Asterisk-1, then the firewall on Asterisk-2's side will overwrite 4569 to
some random port number.
Using this set up, both peers will be unreachable on the other one (using
a iax2 show peers command).
Now, if you can find out what is the port that is being overwritten to,
you can fix the problem this way:

on Asterisk-1 you can have:
[GW2]
type=friend
host=public_ip_address_of_GW2
qualify=yes
context=something
port=_public_port_of_GW2

Interestingly, you don't even have to port forward this second port on the
firewall. Just do a reload and everything will work!
Now, after it worked, you can come and remove than line and reload iax. It
will still work!
It looks like it does some sort of source port authentication. It expects
to "RECEIVE" packet on the specific port defined in IAX peer definition
section. Technically, this should be just for "SENDING" packets not
receiving.
====================================================================== 

---------------------------------------------------------------------- 
 (0094866) Corydon76 (administrator) - 2008-11-13 16:49
 http://bugs.digium.com/view.php?id=13577#c94866 
---------------------------------------------------------------------- 
That is completely not true.  On most firewalls, the port number MUST be
equal for incoming and outgoing packets.  If this were not true, then
connections would NEVER be able to be attained. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-11-13 16:49 Corydon76      Note Added: 0094866                          
======================================================================




More information about the asterisk-bugs mailing list