[OpenSIPS-Users] Fix source IP in a 2-NICs router with openSIPS

Bogdan-Andrei Iancu bogdan at opensips.org
Wed Apr 4 10:14:02 CEST 2012


Hi Víctor,

You have to take care of 2 things:

1) signaling - for this you opensips should only do double RR to record 
the change of interface (in on priv IP and out on pub IP) - to have 
this, before pushing out the call to asterisk, do 
force_send_socket(pub_IP), so that a different interface will be 
selected as outbound.
For contact you do not have to do nothing.

2) media - insert RTPproxy which must be configured in bridging mode (to 
use 2 interfaces). And according to SIP traffic, you need to use the "e" 
or "i" flags (when invoking RTPproxy from script) in order to choose the 
proper IP for media. Like for INVITE (going from priv to pub) instruct 
RTPP to use the pub interface, for the 200 ok reply, need to use the 
priv interface.

Regards,
Bogdan

On 04/03/2012 04:31 PM, Víctor Fernández Martínez wrote:
> Hi! I'm trying to set up OpenSIPS in a router with 2 NICs that performs a
> dynamic NAT. It will receive requests from the UACs on eth0 (NIC behind NAT)
> and should forward them through eth1 (public NIC) to an Asterisk outside of
> the NAT. I'm not allowed to configure the Asterisk. I have also configured
> rtpproxy and would like to use it in order to traverse the NAT. I have
> openSIPS listening on both NICs, so the UACs inside of the NAT connect
> directly to the socket of openSIPS in eth0.
>
> The question is: I have tried to use fix_nated_contact() and fix_nated_sdp() but
> they don't actually change the source IP, so I get no RTP traffic. Seems like
> openSIPS doesn't realise there is a NAT, since it receives the requests
> directly through its socket in the LAN. So when I use
> rewritehostport("IP_OF_ASTERISK"), Asterisk is getting the LAN IPs instead of
> the IP of eth1, which is the public IP. I'm using force_send_socket() to force
> openSIPS to send the SIP messages to Asterisk through eth1. Is there some way
> to fix the IPs so Asterisk gets the public IP (eth1)?
>
> Thank you very much in advance.
>
>
> Barracuda Networks AG
> Vorsitzender des Aufsichtsrates/ Chairman of the supervisory board: Dean Drako
> Vorstand/ Executive Board: Dr. Wieland Alge, Mag. Guenter Klausner
> Sitz der Gesellschaft/ Registered office: 6020 Innsbruck, Austria
> Handelsgericht Innsbruck Firmenbuch/ Registration Number: 184392s
> UID-Nr/ VAT Number: ATU47509003
>
> Diese Nachricht und allfaellige angehaengte Dokumente sind vertraulich und nur fuer den/die Adressaten bestimmt. Sollten Sie nicht der beabsichtigte Adressat sein, ist jede Offenlegung, Weiterleitung oder sonstige Verwendung dieser Information nicht gestattet. In diesem Fall bitten wir, den Absender zu verstaendigen und die Information zu vernichten. Fuer Uebermittlungsfehler oder sonstige Irrtuemer bei Uebermittlung besteht keine Haftung.
>
> This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the material. The sender does not accept liability for any errors or omissions as a result of the transmission.
>
>
> 'Like' us on Facebook for exclusive content and other resources on all Barracuda Networks solutions.
> Visit http://barracudanetworks.com/facebook
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


-- 
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com




More information about the Users mailing list