Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?

user-image
Question ajoutée par Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution
Date de publication: 2014/04/16
Utilisateur supprimé
par Utilisateur supprimé

Is that public ip address or private LAN address.

 

considering as public IP:

 

the domain you mentioned is "java.sun.com" ie an example. where "java" is subdomain.

=> go to the cpanel of the domain and point the ip192.18.97.39 to "java", ie

create cname =java, TTL=14400 , IP=192.18.97.39

 

now  for reverse lookup or fqdn, you need to ask your ISP for PTR.

 

considering as Private IP:

set the name of the computer as "java",

put its ip address as192.18.97.39

register the computer in the domain server which is named as "sun.com" within your LAN network

 

 

Mufeed Farhan
par Mufeed Farhan , HR Applications Manager , SBM

You can use the below code :

 

package com.devdaily.javasamples;import java.net.InetAddress;import java.net.UnknownHostException;/** * Shows how to convert an IP address into a hostname. * Created by Alvin Alexander, http://devdaily.com. */public class InetAddressExample{  public static void main(String[] args)   throws UnknownHostException  {    String hostname = InetAddress.getByName("192.18.97.39").getHostName();    System.out.println("hostname = " + hostname);  }}

 

Copied from : http://alvinalexander.com/blog/post/java/java-faq-convert-ip-address-to-hostname

 

More Questions Like This