Find machine name with ip

I'm looking for a command line tool which gets an IP address and returns the host name, for Windows. The command you are looking for is called nslookup , works fine for reverse lookups IFF someone has configured a reverse zone file, which they don't always do. If you use nslookup command with the IP address as its first argument will return the PTR record the reverse entry if it exists.

For example:. Use dig. A Windows port is available from the ISC here look in the immediate download box for the link to the zip file. Here's their man page reference for dig.

Finding your computer's hostname or IP address

Ward's point about the reverse lookup records often not getting created is very much true. Reverse lookups often do fail because many admins don't bother creating the ptr records. Home Questions Tags Users Unanswered. Resolve host name from IP address Ask Question.

Cookies are disabled

Asked 10 years ago. Active 3 months ago. Viewed k times. DouglasJose DouglasJose 2 2 gold badges 7 7 silver badges 7 7 bronze badges. Related: serverfault. Bruno Bieri 5 5 bronze badges.

ORACLE-BASE - Identifying Host Names and IP Addresses

Moose Moose 1, 7 7 silver badges 7 7 bronze badges. Iljushkin Apr 5 '16 at Flextra - you will need SMB access to the machine. Your VPN may be blocking it. If its on the network and not on the domain for me a unix system of interest then ping -a just formats with the ipaddress alone it looks like.

Works for me. Just what I needed! For many IP addresses you could just use ping -a, for example ping -a Marko Carter Marko Carter 3, 1 1 gold badge 25 25 silver badges 37 37 bronze badges. The functions below can convert IP addresses to its integer decimal value and vice-versa. Here is a simple function I compiled from user-notes that works great..

This function seems to be very slow on IIS 4. HostnameLookups On.

Display Hostname and IP address in Python

I just spent a dickens of a time trying to figure out why my gethostbyaddr's were simply failing halfway through. On each report page, I'm pulling lines from my Db, but only maybe 25 IPs on average.


  • texas marriage license harris county absent applicant form.
  • hillsborough county fl property tax records.
  • illinois pocket watch 20 year warranty.
  • new castle county delaware marriage license.

Sometimes this report would generate in under 15 seconds, other times it would fail with a connection reset. It turns out that several of the IPs in my Db looked like this: x. For my case, I purged the Db and prevented the logging of IPs that contain For ad-rotator. Here is a fail-safe alternative, 1 sec max for timeout per IP. Just to fun that gethostbyadd returns server machine name known in LAN rather then its DNS if I try to call it against my own host from workstation , whether it would local behind the proxy or global of proxy itself IP or just loop Fun :.

To convert an IP to a numeric value, just use the ip2long Vice versa; use: long2ip Be careful with the usage of this function - it will slow down a server to a crawl if called a lot and the slowness won't be reflected in any of the obvious places, like CPU usage, apache requests, SQL etc. When you do use it make a special note of where!

If you use gethostbyaddr with a bad IP address then it will send an error message to the error log.

Get IP and DNS in Powershell

If you don't want your error log file getting too big then first check that the IP address is valid. In the following example I first check if the IP number starts with a number, if not then don't use gethostbyaddr '.. Anonymous has a good point though I don't agree with pushing to execution to shell unless I have to.

Javascript is disabled

Here are two functions that should prove their worth speedwise. Althought I had thought gethostbyaddr would use some kind of cache, it doesn't seem to when the IP is unresolved at least on my win machine. Could you please suggest any solution.. This is also very useful if you'd like to ban these annoying people that keep spamming your forums.