Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: LookupHost only using the first configure DNS server in /etc/resolv.conf on Linux #16215

Closed
bryanvpham opened this issue Jun 29, 2016 · 11 comments

Comments

Projects
None yet
4 participants
@bryanvpham
Copy link

commented Jun 29, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    1.5.1, 1.6.2
  2. What operating system and processor architecture are you using (go env)?
    linux_amd64
  3. What did you do?
    I have a /etc/resolv.conf file with three DNS servers configured. If the first one isn't working properly, the net.LookupHost function will not try to use the other two DNS servers. It used to try all the DNS servers in 1.4.2. But I tested the function in newer versions such as 1.5.1 and 1.6.2, but I get an error saying the first DNS server couldn't resolve my hostname.
  4. What did you expect to see?
  5. What did you see instead?
@bradfitz

This comment has been minimized.

Copy link
Member

commented Jun 29, 2016

/cc @mdempsky for triage

@bradfitz bradfitz added this to the Go1.8Maybe milestone Jun 29, 2016

@bradfitz bradfitz changed the title net package: net.LookupHost() only using the first configure DNS server in /etc/resolv.conf on Linux net: LookupHost only using the first configure DNS server in /etc/resolv.conf on Linux Jun 29, 2016

@mdempsky

This comment has been minimized.

Copy link
Member

commented Jun 29, 2016

Are you able to give more details about how the first DNS server isn't working properly? E.g., is it not sending responses at all? Is it sending bogus responses? What's it doing?

nmap or strace captures of the DNS transaction would be most helpful.

@bryanvpham

This comment has been minimized.

Copy link
Author

commented Jun 29, 2016

I don't have control over the server but it seems like it can connect to it but the server says it can't find anything.

nslookup some.domain.com
Server: 75.x.x.190
Address: 75.x.x.190#53

Non-authoritative answer:
*** Can't find some.domain.com No answer

FYI I did nslookup on the actual domain not the placeholder some.domain.com and 75.x.x.190 is the DNS server.

@mdempsky

This comment has been minimized.

Copy link
Member

commented Jun 29, 2016

Can you please retry your test with dig instead of nslookup?

@bryanvpham

This comment has been minimized.

Copy link
Author

commented Jun 29, 2016

; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.3 <<>> some.domain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13349
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 2800
;; QUESTION SECTION:
;some.domain.com. IN A

;; Query time: 187 msec
;; SERVER: 75.x.x.190#53(75.x.x.190)
;; WHEN: Wed Jun 29 16:08:02 CDT 2016
;; MSG SIZE rcvd: 55

@mdempsky

This comment has been minimized.

Copy link
Member

commented Jun 29, 2016

I assume 75.x.x.190 is the first server in your /etc/resolv.conf? Can you run "dig some.domain.com @$server2", where $server2 is the IP address for the second nameserver in your /etc/resolv.conf?

Can you also provide the output from running "host some.domain.com"?

@mdempsky

This comment has been minimized.

Copy link
Member

commented Jun 29, 2016

Oh, actually I think this is a duplicate of #15434. Can you either try using 1.7 or backporting the fix from 98b99d5?

@bryanvpham

This comment has been minimized.

Copy link
Author

commented Jun 30, 2016

if I modify the standard libarry, what command should I use to make Go rebuild the net package after I implement the fix?

@mdempsky

This comment has been minimized.

Copy link
Member

commented Jun 30, 2016

go install net

@bryanvpham

This comment has been minimized.

Copy link
Author

commented Jun 30, 2016

thank you, I manually fixed it.

@bryanvpham bryanvpham closed this Jun 30, 2016

@mdempsky

This comment has been minimized.

Copy link
Member

commented Jun 30, 2016

Glad to hear that! :)

@golang golang locked and limited conversation to collaborators Jun 30, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.