[asterisk-users] tcpbind and source IP address

Joshua Colp jcolp at digium.com
Mon Mar 13 06:36:47 CDT 2017


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,
> 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



More information about the asterisk-users mailing list