1

resolv.conf

domain example.com

nameserver 192.168.122.54

nameserver 192.168.124.44

Take this as the sample resolv.conf. The scenario is that the DNS tries to resolve in the first name server as mentioned, if it is not able to resolve it should try to resolve using the second name server but it is not happening this way but an exception Unknown host is thrown during HTTPS call in Java code.

Could someone advice on how to resolve this?

1
  • 1
    It is not a problem. Your first nameserver actually gave you a response. Aug 9, 2018 at 16:24

1 Answer 1

4

"if its not able to resolve it should try to resolve using the second name server "

Yeah, except that is not how DNS works.

If server 1 says "can not resolve" THAT IS IT. They are supposed to be redundant, so an answer is an answer.

It will only ask nameserver 2, if nameserver 1 does not respond (i.e. is down).

3
  • Each server will have a specific set of domains to resolve so how can we handle this there will be cases where it will not resolve in the first but will in the second but is not happening like that. Is there any common way to achieve this scenario ? Aug 9, 2018 at 16:30
  • 1
    Ah, no. See, DNS is made for the internet. A server is supposed to work or not to work. It is not supposed to split like that. Actually it is not a server issue - the operating systems do not check that either. SO no, your setup is not supported, period. Make sure every server can resolve every domain, if anything else use forwarders.
    – TomTom
    Aug 9, 2018 at 17:25
  • 2
    @PuratchiSelvan if you need to forward some zones to specific servers, or override some records, or do anything else unusual, then you could install a DNS server locally setting up forwarding based on name. Dnsmasq is one light option, but you could also run bind. As TomTom mentioned the standard resolver simply does not have the kind of functionality that you seem to want.
    – Zoredache
    Aug 9, 2018 at 20:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .