[SR-Users] Avoid resolving names by DNS

Andrei Pelinescu-Onciul andrei at iptel.org
Wed Sep 1 19:25:26 CEST 2010


On Sep 01, 2010 at 19:09, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> 
> 
> On 9/1/10 7:01 PM, Andrei Pelinescu-Onciul wrote:
> >On Sep 01, 2010 at 18:49, Klaus Darilion<klaus.mailinglists at pernau.at>  wrote:
> >>kamailio>= 3.0 is based on ser's core which has implemented its own
> >>caching resolver library. I do not know if there is a way to disable
> >>it complete and use the system's stub resolver. You could try the
> >>"use_dns_cache" option:
> >>http://sip-router.org/wiki/cookbooks/core-cookbook/devel#dns_parameters
> >Yes, if you disable the dns cache it will use the system resolver.
> 
> when the cache is enabled and the record is not cached, will first
> dns query find the records in /etc/hosts and then cache it? Or in
> other words, if a query to internal cache fails, then is used the
> system resolver?

No, the system resolver is never used when the cache is enabled (except
during very early initialisation before mod_init, e.g. mod_register or
 modparam callbacks).
The problem with having fallback to the system resolver is that in case
the entry is not in /etc/hosts (or similar), you will have double
queries for each failure and you would also not be able to do any dns
fallback / srv rec. load balancing (which depend on having cached
records).

> 
> Just for sake of completing info in this thread, disabling
> completely the internal cache is by global parameter:
> dns_cache_init=no

but note also that you won't have dns fall-back.

Andrei
> 
> Thanks,
> Daniel
> 
> >It's also used during the initial startup phase, when the dns cache is
> >not yet fully initialized.
> >
> >You could also leave the cache enabled and add/remove records by hand
> >(using sercmd or xmlrpc) using the dns rpcs (e.g. dns_add_a,
> >dns.add_srv, dns.delete_a a.s.o, for more info see
> >http://sip-router.org/docbook/sip-router/branch/master/rpc_list/rpc_list.html#dns.add_a
> >).
> >
> >Andrei
> >
> >>regards
> >>klaus
> >>
> >>Am 01.09.2010 17:10, schrieb Santiago Soares:
> >>>Hello,
> >>>
> >>>I'm using kamailio as a simple load balancer.
> >>>My dispatcher list is something like that:
> >>>
> >>>1   sip:server1:5060
> >>>1   sip:server2:5060
> >>>2   sip:server1:5060
> >>>
> >>>and /etc/hosts is
> >>>
> >>>10.1.1.1   server1
> >>>10.1.1.2   server2
> >>>
> >>>When I want to do some maintenance task in one of the servers, server2,
> >>>for exemple, I simply change /etc/hosts like that:
> >>>
> >>>10.1.1.1   server1
> >>>10.1.1.1   server2
> >>>
> >>>And all the traffic is redirected to server 1. It's a simple yet
> >>>effective way to remove a server from balancing.
> >>>The thing is that it works on kamailio 1.5.3, but on kamailio 3.0.3 it
> >>>doesn't work, since kamailio appears to resolv names only by DNS.
> >>>I receive this message on startup:
> >>>
> >>>Sep  1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR:
> >>>dispatcher [dispatch.c:241]: could not resolve server1
> >>>Sep  1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR:
> >>>dispatcher [dispatcher.c:247]: no dispatching list loaded from file
> >>>Sep  1 12:04:32 install /usr/local/sbin/kamailio[16077]: ERROR:<core>
> >>>[sr_module.c:874]: init_mod(): Error while initializing module dispatcher
> >>>
> >>>
> >>>Is there any way to avoid this behavior, and force kamailio to use
> >>>/etc/hosts?
> >>>
> >>>Thank you.
> >>>
> >>>Santiago Soares
> >>>Fone: (41) 8488-0537
> >>>
> >>>
> >>>
> >>>_______________________________________________
> >>>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> >>>sr-users at lists.sip-router.org
> >>>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> >>_______________________________________________
> >>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> >>sr-users at lists.sip-router.org
> >>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> >_______________________________________________
> >SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> >sr-users at lists.sip-router.org
> >http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> >
> 
> -- 
> Daniel-Constantin Mierla
> http://www.asipto.com/



More information about the sr-users mailing list