Unless Kamailio implements its own DNS query mechanism, it should use the system library's resolver, which hits /etc/hosts as well. It works for me to use hostnames only in /etc/hosts in my dispatcher list.
Failing that, however, you can run a DNS cache locally like pdnsd or dnsmasq. Pdnsd in particular can source from /etc/hosts, and you can put it in your /etc/resolv.conf as a nameserver.
On 09/01/2010 11:10 AM, Santiago Soares wrote:
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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users