I set up PC with 2 network cards, connected to the same LAN. I can connect to this PC (e.g. by remote desktop) only via ip-addresses. Accessing by hostname does not work.

Why is this the case?

UPDATE: Full environment 1. PC with 2 hardware network adapters.
2. On this PC installed VMWare Workstation. Created 3 VM's, networked by "bridged" network setting in VMWare.
3. In LAN all ip-addresses given from DHCP.
4. Win2k8 on all hosts (both physical and vitrual).
As result:
1. PC has 2 ip-address (e.g. 192.168.1.71 and 192.168.1.72). PC available in LAN by ip-addreses, but not avail by hostname.
2. VM's has own ip-addr on each (e.g. 192.168.1.73, *74, *75 etc). They are available from LAN by their ip's, BUT not by their hostnames.
How can I access to PC and to VM's by hostname?

link|improve this question
1  
are they on the same domain or workgroup? – Daniel A. White Nov 27 '11 at 1:18
Describing a problem just by saying it doesn't work isn't helpful. – David Schwartz Nov 27 '11 at 1:24
Daniel - yes, all computers in same workgroup. – lewis Nov 27 '11 at 1:27
what about any firewalls? – Daniel A. White Nov 27 '11 at 1:33
Firewalls are enabled. But what difference on fw, if host is accessible via IP-address? – lewis Nov 27 '11 at 1:38
show 7 more comments
feedback

migrated from stackoverflow.com Nov 27 '11 at 1:15

This question came from our site for professional and enthusiast programmers.

2 Answers

Hostname resolution is typically handled by your router. Your IP configuration probably has your router's IP address as the DNS server. If that's the case, then the router will resolve the hostname to the local IP address. If you have your system set to use alternate DNS servers, like Google's 8.8.8.8, then hostname resolution may fail.

link|improve this answer
Yes, all my hosts (physical and VM's) obtained ip-addresses from DHCP. DHCP server works on adsl-modem. – lewis Nov 27 '11 at 19:42
feedback

The easiest thing would just be to add the entries in your hosts file.

Open, using administrator privileges - your C:\Windows\System32\drivers\etc\hosts.

This file should already contain a couple lines like:

::1 localhost
127.0.0.1 localhost

Then just add relevant entries:

192.168.0.1 myawesomerouter
192.168.0.10 somethingelse
192.168.0.100 ahundred.domain.org
192.168.2.40 mygooglecopy.google.com

You can also use this to "blackhole" some sites, for example if you never wanted to communicate with www.google.com you could add the line:

127.0.0.1 www.google.com
link|improve this answer
How do you add entries to the hosts file? Could you edit your answer to reflect this? – Simon Sheehan Nov 27 '11 at 16:25
@caimz, I don't want to use this solution, because it need to update hosts on each computer in LAN. IMHO, it is not good solution. – lewis Nov 27 '11 at 17:10
Well it was just a suggestion, since somehow your netbios doesn't seem to be in order to do proper name resolution. Does this apply to all VMs and the host? Also, what kind of router/thingie do you have in front? – cairnz Nov 27 '11 at 18:42
@cairnz Yes, this trouble applies to all VM's and host. LAN is connected to ADSL-modem with DHCP server inside it. – lewis Nov 27 '11 at 19:21
@cairnz, LAN is work. – lewis Nov 27 '11 at 19:31
feedback

Your Answer

 
or
required, but never shown

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