Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a small LAN with local ip addresses like 192.168.0.###. When I ping the network name of one of the machines from the command prompt I get the WAN ip of my router and "request timed out" errors. All the machines are connected to a switch which is then connected to the router. All the machines are set to "obtain ip address manually." All of the machines are running Windows 7 Ultimate. Windows networking works as usual with network shares setup and accessed through explorer. Any ideas as to why this is happening or tutorials on how to properly configure my LAN would be greatly appreciated.

share|improve this question
    
when you say network name, do you mean DNS, Windows host name, or both? do you have a windows domain? what is your DNS server setting for the effected box, and do you have more than one subnet? usually unless you are using a MS domain, name resolution on dynamically addressed machines can be problematic. it is better to statically address your network if you wish to use names, but don't plan to use any advanced naming technology like dynamic name registration. –  Frank Thomas Dec 12 '13 at 16:53
    
What's the exact command you are trying to run? Are you including domain information in the "name"? What are you using for a DNS server on the client(s)? When you do an NSLookup <computername> what IP is returned for the host you looked up? What IP is returned for the DNS server NSLookup says it's using? –  Ƭᴇcʜιᴇ007 Dec 12 '13 at 16:53
    
Thanks guys! I have a very simple setup: a group of win7 machines and a router connected to a switch. There is no windows domain just a workgroup. What I am trying to accomplish is to determine the ip address of a machine on the lan by use of the computer name (i used the wrong wording in the title). The dns server is set by the dhcp host which is the router. –  ElvisDumbledore Dec 12 '13 at 17:01
    
The machine's IP address is obtained either via DHCP or you type it in manually as in your case. Windows networking (i.e. shares via SMB protocol also known as CIFS) likely resolves the computer name from your local network share advertisements (NetBIOS share names) - hence you can do lookups (access shares) with your windows explorer. Programs relying just on standard internet TCP/IP mechanisms such as ping don't do that. For them it is necessary to have some internet standard name resolution - such as through hosts file or DNS. –  r0berts Dec 12 '13 at 17:36

3 Answers 3

up vote 1 down vote accepted

The problem lies in name resolution (translating names to IPs and vice versa). Depending how big your home network is you can choose two solutions:

1) Hosts : Edit %systemroot%\system32\drivers\etc\hosts file on each windows machine. It is likely in C:\windows\system32\drivers\etc\ for a standard windows installation. You may need to open notepad as Administrator for this (i.e. right click Notepad, choose run as). All lines containing hosts should start without whitespace at the beginning. Comment lines start with #. Comments can also be appended at the end of the line provided there is at least one whitespace between the last name and the comment. Host lines should start with IP address then one or more names that you will be using for that particular host. Whitespaces (or tabs) serve as separators.

Example:

127.0.0.1 localhost    
192.168.0.1 pc1.local.domain pc1
192.168.0.2 pc2.local.domain pc2
192.168.0.3 pc3.local.domain pc3
192.168.0.4 pc9.local.domain pc9 # name has no correspondence to IP address ;)
192.168.0.7 pc7.local.domain 
# either 1 or 254 usually serves as the gateway so:
192.168.0.254 gw.local.domain gw
# and certainly you don't have to use FQDN for your LAN so:
192.168.0.7 pc8 # is good too, just like localhost entry

Note: no correspondence between last part of IP address and the name itself. Common sense says if you give more than one name (synonyms) - the short name should correspond to the host part (i.e. the word before the first dot in the name) of the long machine name (so called FQDN). Short name is great for pinging, opening shares, etc. Theoretically you could give several synonyms, practically I don't know why this would be necessary in a small home network. See this TechNet article for further information.

Obviously the downside is - you need to keep hosts file the same on all of your computers.

As to your router - it is likely just a forwarder for your ISP (or google DNS server), so I do not think you can configure that one to resolve names for your internal LAN. Even if you succeed to hack it spending time and effort, after the next firmware update you may need to do that again. But if you have a router which provides to set up LAN DNS - please do let me know what make it is :)

2) DNS : install configure and run your own DNS server. There are several available. Depends not so much on the size of your nework, but rather on whether you want to delve into configuration of zones, etc. I did it a couple of months ago for my home network consisting of just 5 machines (including router) - but I did so that I can run SAMBA4 AD server.

share|improve this answer

Blame Microsoft: they think any open port is a security hole, because for a long time in windows any open port was a security hole, so the default is to firewall everything, including imcp echo, which makes ping work. So you need to adjust your firewall rules to allow safe protocols, and if imcp echo is not safe on your computer, you have bigger problems.

share|improve this answer

As of why you get WAN IP-address , I have no idea. But there are a few things that will help you overcome your problem :

  • Setup your host names within router (or setup lease reservation : This could also be called "DHCP Static Lease" or something similar.)

enter image description here

  • Set your DNS to gateway.(no one prefers it)

ping statistics while gateway is set as DNS :

enter image description here

ping statistics while OPENDNS is set as DNS:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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