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.
3 Answers
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.
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.
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.)
- Set your DNS to gateway.(no one prefers it)
ping statistics while gateway is set as DNS :
ping statistics while OPENDNS is set as DNS:
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?