#644 closed defect (fixed)
DNS resolution issue with CURL on AdHoc VM
Reported by: | dmorissette | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | SysAdmin | Keywords: | |
Cc: |
Description ¶
Some DNS resolution issues with programs using the CURL library have been reported on the AdHoc VM recently: CURL is unable to resolve any hostname. OTOH, dig on the same hostname does work:
dmorissette@adhoc:/tmp$ curl -v http://www.google.com/ * getaddrinfo(3) failed for www.google.com:80 * Couldn't resolve host 'www.google.com' * Closing connection #0 curl: (6) Couldn't resolve host 'www.google.com' dmorissette@adhoc:/tmp$ dig www.google.com [...] ;; ANSWER SECTION: www.google.com. 604759 IN CNAME www.l.google.com. www.l.google.com. 259 IN A 74.125.155.106 [...]
Based on a quick web search, it seems that this kind of problem is related to the "hosts" setting in the /etc/nsswitch.conf.
We currently have the following line in /etc/nsswitch.conf:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
... and I verified that if I put "dns" before "mdns4_minimal" then CURL works fine:
hosts: files dns mdns4_minimal [NOTFOUND=return] mdns4
I would also note that I checked two other VMs (projects and backup) and none of them has the mdsn4 stuff, only a simple
hosts: files dns
... so it seems that someone intentionally changed this in the AdHoc VM since it was created.
Unfortunately I don't know enough about the nsswitch.conf and mdns4 to be sure that the proposed fix above won't have other bad side-effects. Hopefully whoever added the mdns4 stuff will see this ticket and can confirm that the change to put "dns" right after "files" would be fine.
Change History (2)
comment:1 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 14 years ago
I think we can firmly assume every appliation which does _not_ work with "files dns" to be broken (as long as the 'hosts' file is correct ;-)
I applied the proposed fix in /etc/nsswitch.conf on the AdHoc VM and included a comment referring to this ticket:
Closing ticket. Please re-open if this change caused some side-effects.