Unable to locate hosts by hostname in mixed Linux and Windows LAN

1

I have a LAN with Windows 7 and Debian 8 hosts. The stations get IPs via the router/switch DHCP.

Everything goes fine if trying to connect or ping by their IP addresses, as it should be. The problem is when I try to ping or connect for different services using the hostname of the stations. There is no problem if the involved stations are the ones running Windows 7 only, but the connectivity among linux-linux, or linux-windows (also windows-linux), is not possible using hostnames.

I have installed the samba package, as some linux forums advise to solve this same issue, but after rebooting, the situation doesn't change. I am not still able to connect via hostname.

The reason for using hostnames instead of IPs is that some of the stations are virtual machines [VMware] and I want to be able to clone and copy them without having to worry about dynamic IPs via DHCP. The potential number of stations is high.

shirowww

Posted 2017-05-30T20:07:13.447

Reputation: 111

Answers

1

IP hostnames are resolved by your local DNS server, which is very likely part of the router that also runs DHCP. So the simplest way is to configure your hostnames in the router. Many routers have a GUI that allows you do to that, and allow some local domain to find local machines.

If your router doesn't run a DNS server, an alternative is to run a DNS server on one of your machines, and configure your router to give out this nameserver address on DHCP requests. But it's really easier to run it directly on the same machine that does DHCP.

To debug what's going on, look at the nameserver entry in /etc/resolv.conf on your Linux machines to see which DNS server address they got. Also look what happens when you try to resolve a hostname, e.g. host -v your_machine.your_domain.

To explain the suggestion with Samba: Windows can use IP hostnames via DNS, but it also uses a Windows networking system where one machine provides a hostname lookup function for the rest. Samba can ursurp this function, and then provide a mapping to other hostnames for connected Windows machines. But that doesn't affect your Linux machines, which will be using DNS to find hostnames, and not the Windows method.

dirkt

Posted 2017-05-30T20:07:13.447

Reputation: 11 627