Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)

I would like to get the remote machine/hostname through IP Address. I found lots of answers such as the nslookup, host, resloveip, etc.. but I still can't get hostname from my target machine(centOS, ubuntu, etc...) Does it seem to need to register to the DNS server?

I have a machine named to test and using IP 10.1.27.97

but I used the method above still can't get "test"

Can anyone help me to get the hostname to form an IP Address?

1 Answer

0 votes
by (36.8k points)

In order to use the nslookup, host, or gethostbyname() then the target's name will need to be registered with DNS or statically defined in this host's file on a machine running your program. Yes, you could connect to a target with SSH or some other application and query it directly, but for a generic solution, you'll need some sort of the DNS entry for it.

Want to be a Linux expert? Come and join this linux course

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jan 16, 2021 in Linux by supriya (36.8k points)
0 votes
1 answer

Browse Categories

...