can not ping by host name for some computers
Solution 1:
Just add WINS
to the hosts:
line in the /etc/nsswitch.conf
file:
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat lsass
group: compat lsass
shadow: compat
hosts: files mdns4_minimal [NOTFOUND=return] wins dns mdns4
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
This tells the system to use WINS in order to lookup netbios. The winbind
package has to be installed for this to work.
Solution 2:
For a more hackish method then the one listed by @Saariko you could edit your hosts file. This is not a robust solution and has to be updated manually, if your network set up changes.
It can also hide network problems if names don't resolve correctly through other tools like wins and dns
Host file on Ubuntu and many other *nix is found
/etc/hosts
In windows the hosts file is usually found
C:\WINDOWS\system32\drivers\etc\hosts
%systemroot%\system32\drivers\etc\hosts
To make changes in Ubuntu edit the file and put in the ip address and hostnames you want.
sudo vi /etc/hosts
192.168.1.1 servername
192.168.1.2 server2name
In my host file I add all the web severs I set up for my web development
127.0.0.1 local.home 127.0.0.1 local.site1
Then I can ping
$ ping local.home PING local.home (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.037 ms