-2

Even after a long time googling, I couldn't find a way to convert a FQDN to IP address using DNS which is running in a local network.

Basically My question is how do I convert a FQDN to ip with a specified DNS and not google DNS or something like that.

  • [`java.net.InetAddress`](https://docs.oracle.com/javase/7/docs/api/java/net/InetAddress.html), found through [DNS query in JAVA](http://stackoverflow.com/questions/28560135/dns-query-in-java), found by googling [`java dns lookup`](https://www.google.com/search?q=java+dns+lookup). – Andreas Aug 25 '16 at 06:27

1 Answers1

-1

Is this what you are looking for

    String ip_address = "8.8.8.8";
    InetAddress addr = InetAddress.getByName(ip_address);
    System.out.println(addr.getHostName());

    String fqdn = "google-public-dns-a.google.com";
    InetAddress addr1 = InetAddress.getByName(fqdn);
    System.out.println(addr1.getHostAddress());
saikumarm
  • 1,565
  • 1
  • 15
  • 30