well I just went into the Ubuntu world for administration. I found similar threads, except, I am able to ping my own Host name and IP address and my windows can ping my linux host name, but Ubuntu can not ping the windows hostname.
Problem:
- I have 4 windows computers and I have 1 Ubuntu Computer
- My windows Computer can ping Ubuntu Computer by Hostname and by IP address. Also, Net
View (cmd prompt) displays the host name of Ubuntu Computer. - Ubuntu Computer can only Ping by IP address only Not by hostname. I installed Samba as well.
- Ubuntu Computer can ping itself by IP address and by Hostname
- I can use arp command and will display all the computers IP on the network, but only by IP address.
How is it that I can only ping by IP address and not by hostname to the windows computers? But Ubuntu can ping itself by IP address and Hostname and windows computers can ping Ubuntu by hostname as well?
Best Answer
The problem described here may not be related to DNS at all.
You have to know that Windows can resolve the Windows hostname to its IP via other mechanisms than standard DNS : NetBIOS lookup, WINS, ...
As you said you have Samba installed on your Ubuntu, this is probably what's happening. On all of your Windows machine, it is possible, out-of-the-box, to have the Windows name resolved to its IP address. As Samba is installed on Ubunut, for your Windows PC, they see the Ubuntu PC as a Windows PC and the same resolution is possible.
You tell that you run
net view
on Windows and you see your Ubuntu PC, so the NetBIOS name is well published on your network, so it works from Windows.To achieve the same behaviour on Ubuntu as on Windows, you have to install and configure additional pieces of software. What you need is to add a lookup library that will allows Ubuntu to convert NetBIOS names to IP. This library is contained into the libnss-winbind package.
As any other Ubuntu packages, you install it by doing
sudo apt-get install libnss-winbind
. May be the library is already installed, you can check it presence by doingdpkg -l|grep libnss-winbind
.Once the library is installed, you have to enable it in the
/etc/nsswitch.conf
file. This file is the configuration file for the NSS (Name Service Switch), which defines from which sources Linux is able to resolve hostname, usernames, groupnames and so on.In this file, you already have a line starting by
hosts:
, probably looking like thisThis tells your system to first look into the
/etc/hosts
file and then into the configured DNS to resolve hostnames.You have to modify this way :
Note that the order of the words files, dns and wins are important. First, the system will check the local file for resolution, then will ask the DNS server and finally, if not yet found, will perform NetBIOS lookup.
Once this is updated, to function correctly, you also need to have the winbind service running. The package containing it is a dependency of libnss-winbind, so it has been installed along it.
Do
service winbind start
to activate it.