Hello all,
Thank you for your enlightening answers. I ended up creating DNS entries anyway, so it's all good now. use_dns_cache=no sounded a little scary :-).
BR. George
On Tue, 19 May 2020 at 19:44, Daniel-Constantin Mierla miconda@gmail.com wrote:
A quick follow up as I found quite interesting that nowadays *BSDs allow specifying order of lookup in resolv.conf to include the hosts file, but that doesn't seem to be in Linux:
Cheers, Daniel
On 19.05.20 17:48, Daniel-Constantin Mierla wrote:
Hello,
worth to clarify that Kamailio doesn't implement a dns resolver from scratch, it still uses the functions from libc. It only does caching and try to use cashing records first.
By default, the following dns functions are used internally when the cache doesn't have the record already -- they are set in the dns_func structure:
struct dns_func_t dns_func = { res_init, res_search, gethostbyname, #ifdef HAVE_GETHOSTBYNAME2 gethostbyname2 #else NULL #endif };
So practically by leveraging res_init()/res_search() is relying on /etc/resolv.conf to do DNS queries, which is not using the /etc/hosts (iirc). For more see:
Cheers, Daniel
On 19.05.20 17:23, Alex Balashov wrote:
You are correct that Kamailio does not use the libc resolver / libresolv, but rather its own resolver, which ignores /etc/hosts.
-- Alex
On 5/19/20 10:42 AM, George Diamantopoulos wrote:
Hello all,
I've come across this today when trying to setup DMQ replication:
root@sbcpub0-stage-lhe0-cn1:/root# systemctl restart kamailio root@sbcpub0-stage-lhe0-cn1:/root# kamcmd dmq.list_nodes { host: 172.30.154.189 port: 5090 resolved_ip: 172.30.154.189 status: active last_notification: 0 local: 1 } root@sbcpub0-stage-lhe0-cn1:/root# getent hosts dmq-ng.services.domain.com http://dmq-ng.services.domain.com 172.30.154.189 dmq-ng.services.domain.com http://dmq-ng.services.domain.com 172.17.130.13 dmq-ng.services.domain.com http://dmq-ng.services.domain.com
root@sbcpub0-stage-lhe0-cn1:/root# grep dmq-ng /etc/kamailio/* /etc/kamailio/kamailio-module-params.cfg:modparam("dmq", "notification_address", "sip:dmq-ng.services.domain.com:5090 http://dmq-ng.services.domain.com:5090")
In another case, where the resolving IPs for the DMQ service hostname were listed as A records in DNS, this worked as expected. In this case, the second host of the DMQ group is not listed in dmq.list_nodes, despite its being set in /etc/hosts, as shown by the getent command.
Doesn't kamailio use nss for hostname resolution? Am I missing something else? Thanks!
BR, George
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users