How this works: ping computer name

2

I am just wondering how this works in the situation: Two of my computers (OS=Windows) are in same subnet and workgroup. There is no DNS and WINS set. But I can ping each other with the computer names.

when I perform nslookup, like "nslookup PC-A", no valid record is found when I perform ping, like "ping PC-A", it works.

Any answer is highly appreciated!!

user3162764

Posted 2014-01-06T15:34:44.367

Reputation: 23

Answers

8

NetBIOS allows your computer to "discover" names by basically broadcasting. An example would be like this:

1) You ping PC-B
2) Your PC (PC-A) broadcasts via NETBIOS: "Who has PC-B? Reply to x.x.x.x"
3) PC-B sees the response, responds "PC-B is at x.x.x.x"
4) PC-A takes this result, resolves the name.

And you're done. This is essentially the same as a DNS lookup except you're asking the network instead of a DNS server. The same behavior is done with ARP for MAC->IP mappings.

The specific behavior is from NETBIOS-NS.

Nathan C

Posted 2014-01-06T15:34:44.367

Reputation: 2 522

Thanks. Today I encountered a strange event, after I changed the DHCP reserved IP for PC-A, when I ping PC-A (joined domain abc.com), the DNS suffix is auto appended, it resolves the updated IP, however, if I remove the DNS suffix append, ping PC-A resolved the old IP. What would be the cause? is this a DNS issue? or related to NetBIOS? – user3162764 – 2014-01-06T16:12:08.803

@user3162764 DNS caching. Run a ipconfig /flushdns and try again. – Nathan C – 2014-01-06T16:22:17.063

4

alexus

Posted 2014-01-06T15:34:44.367

Reputation: 2 484

then if the computer joins a domin(abc.com), and there is DNS server, is that correct? ping PC-A (NETBOIS) ping PC-A.abc.com (DNS) – None – 2014-01-06T15:43:24.953

i believe this is correct. – alexus – 2014-01-06T15:48:09.010

OS's employ a name resolution order, which defines what means and in what order they will attempt to identify a name. usually they start with the hosts/lmhosts file on the local system, then DNS, and then NETBIOS broadcast. thats why you can override a DNS name by adding it to your hosts file. – Frank Thomas – 2014-01-06T16:36:05.047

@alexus Try outlining the article some in your answer to give the user a bit more information instead of just linking – cutrightjm – 2014-01-06T18:11:10.370