[Asterisk-Users] How to bind RTP when IP alias are configured
Robert Hajime Lanning
lanning+asterisk at monsoonwind.com
Mon Jan 12 15:03:14 MST 2004
<quote who="SW">
> Hi Folks,
>
> I have a situation where my Colo insists on a particular IP setup for my *
> server box. They allocate two blocks of IPs to my colo server. One set as my
> own (ex 20.20.20.20.4/30 - 4 ips) and the other as a transit lan (es
> 10.10.10.0/29). These are all public IP addresses and there is no NAT
> involved in.
>
> So essentially I have to set-up IP aliases in my Linux box as follows;
>
> Example:
>
> TRANSIT LAN: 10.10.10.0/29
> CUSTOMER LAN: 20.20.20.20.4/30
>
> RedHat LINUX
>
> FILE: /etc/sysconfig/network-scripts/ifcfg-eth0
>
> DEVICE=eth0
> IPADDR=20.20.20.20.4
> NETMASK=255.255.255.255
> ONBOOT=yes
>
> FILE: /etc/sysconfig/network-scripts/ifcfg-eth0:99
>
> ####################################
> ## TRANSIT IP: DO NOT UNCONFIGURE ##
> ####################################
> DEVICE=eth0:99
> IPADDR=10.10.10.4
> NETMASK=255.255.255.248
> NETWORK=10.10.10.0
> BROADCAST=10.10.10.3
> GATEWAY=10.10.10.1
> ONBOOT=0
>
> ----------------------------
> First of all. I can ping to customer lan and telnet to it, therefore IP
> routing (at least for unicast traffic) works fine.
>
> Now question arises when asterisk start to work on this box. Since the IP
> that I am supposed to use is 20.20.20.4, I set that as bindaddress in my
> sip.conf file. As far as SIP messages are concern * users that IP address,
> no problem. However for RTP stream * users 10.10.10.4 as it's source
> address. Because of this obviously calls will not go through asterisk, as
> the ip phone is expecting RTP packets from the SIP server which is bound to
> IP 20.20.20.4.
>
> Is there a way to tell * to use the same bind address in SIP.conf
> (h323.conf, iax.conf) for RTP ?????
>
> I read rtp.conf file but that does not show any bind address.
>
> It seems like LINUX always select it's src address as the interface (alias)
> which has the gateway tied to it unless otherwise an application
> specifically asks Linux to use a particular ip address.
rtp.c uses 0.0.0.0 (hardcoded, well kindof, the whole struct is initialized to
zeros, so, it is just not set)
Since, to get around NAT issues, I have a host route on my firewall
(Linux IPTables), I have the same problem.
In rtp.c -> function ast_rtp_new()...
rtp->us.sin_family = AF_INET;
/* the next line was added to fix host route hack instead of NATing */
inet_aton("20.20.20.4",&rtp->us.sin_addr);
rtp->s = socket(AF_INET, SOCK_DGRAM, 0);
Sorry, no context diffs. When I get around to adding an rtp.conf keyword, I
will provide context diffs to bugtrack.
--
END OF LINE
-MCP
More information about the asterisk-users
mailing list