14

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?

  • Try the hostname in ALL CAPS. that could be the trick. – jrg Aug 6 '14 at 14:40
  • Yeah, I tried that, but no luck. =( Someone said to add .local at the end. My co workers said I have to configure the network to point at the router in order for it to understand. So I will try that out, and if it works, I'll go ahead and post the answer – user2805313 Aug 6 '14 at 15:37
  • It may be a DNS server problem. Configure DNS server settings correctly. Maybe these two sources can help you. serverfault.com/questions/389522/…. askubuntu.com/questions/23011/…. – Wolverine Dec 30 '14 at 0:02
22

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 doing dpkg -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 this

hosts:          files dns

This 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 :

hosts:          files dns wins

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.

  • Don't forget to use sudo with the service winbind start command. – Tristan Oct 9 '15 at 3:42
0

Hostnames to IP conversion can occur if:

-You declare them in the /etc/hosts file (not recommended)

-You get it from a DNS server.

I would say your problem can be your network interface configuration has no DNS server or uses not the one Windows boxes use. If they use DHCP interface configuration, DNS configuration is most often included, and if you have a Windows Domain server on your network, they most probably use it as primary DNS.

Try: 'nslookup some_machine_name' in command line to see what happens. It will tell you which server you're using if any.

HTH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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