In my local network (home) there is a lot of connected computers and phones. I want to know if there is a way to get the names of connected computers (when i say the name, i mean the name that the user give it to the computer when he install the OS).

  • Did you initially indicate that this was your home network or was that an edit after the fact? Just curious as it affects the scope of my answer. Thanks. Jan 4 '16 at 20:54
  • Disregard my last question, I answered it myself. Jan 4 '16 at 20:59
  • it wasn't an edit man, i said it in the original post.
    – Sidahmed
    Jan 4 '16 at 21:02
  • extended my answer
    – davidb
    Jan 4 '16 at 21:17
  • Not sure it is adding another answer when you have several good ones, but another option, if you control the network, is going to be to look at the DHCP server's lease database. This will almost always include a client id, which will be the hostname.
    – Zoredache
    Jan 4 '16 at 21:31

This can be done in several ways but the ways available to you are limited by the operation systen on the hosts.

Browser (Passive - Windows only)

You can run wireshark with a filter set to browser which filters for the Samba BROWSER protocol. Its used to announce by windows PCs that they are present in an intervall. These packets are broadcasted and contain the computers name.

mDNS txt "responses" (Passive - MAC only)

You can run wireshark with a filter set to dns && udp.dstport==5353. mDNS is basicly the DNS protocol over multicast. It is exclusicly used by apple hosts as far as I know. In the mDNS "responses" (They are sent without a request for real) there is the hostname of the sending host included.

DHCP Informs (Passive)

You can run wireshark with a bootp filter which is the protocoll DHCP was later appended to. Clients that received a DHCP lease publish the configuration in intervalls. These inform packets also contain the name of the client who sent the inform packet

Portscan & Reverse DNS (Active)

You can also portscan the network for hosts and then run a script that resolves ths entries in reverse by dns requests. This will of cause only work if you have a "real" internal DNS-Server and not only a relay.

Portscan & Banner Grabbing (Active)

You can portscan the network and enable banner grabbing because these banners in many cases contain the hostname.


You may be in the wrong spot for this question, however I can see how it could have some security implications so I'll answer it anyway.

If you're on a domain (whether it's a Microsoft Active Directory domain or some sort of *nix domain, or any LDAP domain) you could run some sort of ping sweep tool to scan for all the IPs on your local subnet/network-segment; one free tool that I like to use sometimes is called Advanced IP Scanner. A lot of these ping sweep tools will return an IP and/or MAC address of the computers they find, and many of them will even return the computer name for you which means you don't even need to go to the next step that I'll describe. This doesn't mean that you'll find all the computers on your network as you may be VLAN'd off from other users/computers and you may not know of all the subnets/IP schemes involved. Once you have the IPs of the devices that your ping sweep produced you could either do an NSLOOKUP (this is assuming you're on a Windows domain and that your DNS setup has Reverse, or PTR, records setup in relation to a forward lookup DNS zone) using Command Prompt or PowerShell, or whatever the *nix equivalent command is. If you have the reverse zone setup in DNS your DNS servers should return the names of the computers that you type in.

Now, if you're at work, or on your enterprise company network my answer is this: do not ever attempt to scan your network with any kind of packet capturing, ping sweeping software. If you really need to do this, then get the proper permission and signed forms and have a system administrator, network administrator, or security officer do this for you. Regular users (outside of IT) should not have the ability to run these scans on your network and if they do they most likely could be in violation of company policy; I'm a federal contractor and the agency I work for would terminate anyone in an instant if they were caught doing this type of scanning that I recommended above if they weren't the proper personnel. Now, if you happen to be a system administrator, which I highly suspect that you're not, then you could do this yourself.

  • Whoah, this guy's just talking about scanning his home network. Not checking up on the NSA.
    – Iszi
    Jan 4 '16 at 20:52
  • Was there an edit? I didn't see the (home) part of the question initially. Jan 4 '16 at 20:53
  • 1
    @Iszi Funny, but I do think his post has merit. This is a security forum, and his response is well-within the realm of infosec. The only issue is he's made me paranoid now... they're coming for me! Jan 4 '16 at 20:55
  • I've clarified my final paragraph to fit the context of his original question. Jan 4 '16 at 20:58

This would be better off on superuser, but do heed Brad Bouchard's advice.

  1. On Windows (cmd): for /L %n in (1,1,255) do @nslookup 192.168.0.%n >> machines.txt
  2. On Windows (cmd): net view
  3. Using nmap: nmap -sP (may need to be root if on Linux)
  • 1
    I like #1 and 2 in particular... simpler than my answer, but I wanted to give him an idea of why it wouldn't be good for him to try using ping sweep tools... nice input though... Jan 4 '16 at 20:44
  • 1
    I just tried it here to make sure it worked, then closed the window. Hope I don't get in trouble. ;) Jan 4 '16 at 20:44
  • 1
    must admit, I tried it too... worked brilliantly, and I'm sure the network admin who sits next to me will come knocking... :) Jan 4 '16 at 20:45
  • i have used nmap several times ago, and it never gives computers names. Thanks for the answer anyway.
    – Sidahmed
    Jan 4 '16 at 21:04
  • @Sidahmed Have you tried these methods specifically? These are three different methods. Jan 4 '16 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.