[asterisk-users] tcpbind and source IP address
Kseniya Blashchuk
ksyblast at gmail.com
Mon Mar 13 06:43:54 CDT 2017
Mmh sorry I'm afraid I did not understand your last message. Yes the code
does that but only with UDP, for TCP the source address is 192.168.0.172
though it's bound to 192.168.0.177:
IP 192.168.0.172.47596 > <mydestip>.5061
If it was a system/kernel issue, then why is the behavior different for TCP
and UDP? I thought that maybe the application does not request the bound
address as a source in case of TCP...
пн, 13 мар. 2017 г. в 14:37, Joshua Colp <jcolp at digium.com>:
> On Mon, Mar 13, 2017, at 08:31 AM, Kseniya Blashchuk wrote:
> > Yes, look:
> > netstat -nlp | egrep '506[01]'
> > tcp 0 0 192.168.0.177:5061 0.0.0.0:*
> > LISTEN
> > 13255/asterisk
> > udp 0 0 192.168.0.177:5060 0.0.0.0:*
> > 13255/asterisk
> > Still, the problem is with *outgoing* *TCP* packets originated from
> > asterisk. Source IP is set to the first IP address of the interface only
> > when TCP is used. As I understand, the application (chan_sip in this
> > case)
> > should request kernel to use the specific source IP address (used in bind
> > directive) for outgoing packets, however it seems to be done only for
> > UDP.
> > For outgoing packets on TCP/5061 I see the following:
> > IP *192.168.0.172*.47596 > <mydestip>.5061: Flags [S], seq 2529313754
> <(252)%20931-3754>,
> > win
> > 29200, options [mss 1460,sackOK,TS val 82765588 ecr 0,nop,wscale 7],
> > length
> > 0
> > And with UDP as transport:
> > IP *192.168.0.177*.5060 > <mydestip>.5060: SIP: OPTIONS ....
>
> The underlying code does this already. It connects using the bound
> socket (which would be bound to the IP address you've provided). This
> should have the system use the source IP address as you want, but it's
> evidently not.
>
> --
> Joshua Colp
> Digium, Inc. | Senior Software Developer
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - US
> Check us out at: www.digium.com & www.asterisk.org
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at:
> https://community.asterisk.org/
>
> New to Asterisk? Start here:
> https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170313/cfb2eb6e/attachment.html>
More information about the asterisk-users
mailing list