[asterisk-users] chan_sip sending from wrong source address when multiple interfaces are used
Benny Amorsen
benny+usenet at amorsen.dk
Thu Jul 12 15:53:35 CDT 2012
"Kevin P. Fleming" <kpfleming at digium.com> writes:
> I must be missing something. If a phone sends a UDP packet to
> 192.168.1.1, how does that get routed to (arrive at) the 10.0.2.1
> interface on the Asterisk server?
The easiest way is that the Asterisk server itself is the router. Phones
on 10.0.2.0/24 have 10.0.2.1 as default gateway. Another option is that
there are no real routers; the phones are disconnected from the
Internet, they still have 10.0.2.1 as default gateway but they only use
it to reach the Asterisk server.
> The only way I can imagine that happening is if a router in between
> the phone and the server has been told that 192.168.1.0/24 is
> reachable *through* 10.0.2.1, which seems like a bizarre way to
> construct a network.
I do not feel that the two scenarios above are particularly bizarre.
> Getting replies from Asterisk *back* to the phone would also require
> the IP stack on the Asterisk server to route those replies back over
> the 10.0.2.0/24 interface instead of the 192.168.1.0/24, which doesn't
> make any sense either.
If the phone is on 10.0.2.0/24, the IP stack will route packets to it
directly through the 10.0.2.1-interface by default. It actually takes
quite serious contortions to make it send the packets elsewhere.
Servers with multiple interfaces are a bit out of the ordinary. Right
now Asterisk is difficult to work with on such servers, which is not a
large problem for Asterisk in general, because they are so rare. You can
always work around the problem either by creative routing or by
explicitly binding to one address.
> chan_sip does have the ability to use connect()-ed sockets for dialogs
> now, since that is required for TCP, TLS and WebSocket support. It
> wouldn't be a huge leap to use them for UDP as well, if that was
> beneficial.
It would be greatly appreciated :) It is low priority for the Asterisk
project, as there are always workarounds.
Extra points for making Asterisk support IP addresses appearing and
disappearing... That would make VRRP/HSRP failover work. (It "works" if
you bind to 0.0.0.0, but it is difficult to get Asterisk to use the
VRRP-address as the source address for outgoing packets).
/Benny
More information about the asterisk-users
mailing list