You are not logged in.

#1 2018-01-13 04:56:32

blarg
Member
Registered: 2018-01-12
Posts: 8

[SOLVED] ping/etc cannot resolve windows machines hostnames

Hi, from my linux machine I cannot resolve the hostname of windows (7) machines when using programs like ping or the tigervnc client, I have to use their IP addresses.

Although:

* linux machine hostnames work fine
* samba can resolve the hostnames fine (e.g. from the filemanager or nmblookup).

I've tried googling this problem, the few solutions (here, here) mention using winbind (which seems outdated now? as there is no package) or putting "wins" in the hosts section of "/etc/nsswitch.conf ".

Here is my "/etc/nsswitch.conf" file:

# Begin /etc/nsswitch.conf

passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat

publickey: files

hosts: files mymachines resolve [!UNAVAIL=return] mdns_minimal [NOTFOUND=return] wins dns myhostname

networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files

# End /etc/nsswitch.conf

I've tried moving the "wins" around after the "files", or after the "dns" but it does nothing.

Thank you.

Last edited by blarg (2018-01-13 15:59:03)

Offline

#2 2018-01-13 08:58:41

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

Can you resolve the names of the Windows machines correctly with dig/drill? E.g.

drill mywindowshost

Do you have a local DNS server? Or how do you manage your network connections overall?


pkgshackscfgblag

Offline

#3 2018-01-13 09:12:52

blarg
Member
Registered: 2018-01-12
Posts: 8

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

yes drill seems to work:

;; ->>HEADER<<- opcode: QUERY, rcode: NXDOMAIN, id: 32451
;; flags: qr rd ra ; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 
;; QUESTION SECTION:
;; newcomp.	IN	A

;; ANSWER SECTION:

;; AUTHORITY SECTION:
.	73966	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2018011300 1800 900 604800 86400

;; ADDITIONAL SECTION:

;; Query time: 121 msec
;; SERVER: 192.168.1.254
;; WHEN: Sat Jan 13 20:09:41 2018
;; MSG SIZE  rcvd: 100

Do you have a local DNS server? Or how do you manage your network connections overall?

I have a router that all my computers are connected to.

Offline

#4 2018-01-13 09:20:16

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

That drill reply doesn't show any reply for your query (see the ANSWER SECTION being empty).

Are you sure that your Windows machine is only called `newcomp`, and not something like `newcomp.local`? (this would require additional tweaking)


pkgshackscfgblag

Offline

#5 2018-01-13 09:54:52

blarg
Member
Registered: 2018-01-12
Posts: 8

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

Are you sure that your Windows machine is only called `newcomp`, and not something like `newcomp.local`? (this would require additional tweaking)

Yeah only "newcomp", samba can access it from that name. "newcomp.local" doesn't give an answer either.

Offline

#6 2018-01-13 10:22:23

ayekat
Member
Registered: 2011-01-17
Posts: 1,590

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

OK, last thing: What's the IP addresses of those Windows machines? They don't happen to be in 169.254.0.0/16 range?

Otherwise I'm a bit out of ideas here...


pkgshackscfgblag

Offline

#7 2018-01-13 10:23:12

progandy
Member
Registered: 2012-05-17
Posts: 5,194

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

hosts: files mymachines resolve [!UNAVAIL=return] mdns_minimal [NOTFOUND=return] wins dns myhostname

Are you running systemd-resolved? Then everything after "resolve" will be ignored.
Edit: That shouldn't be the problem, I missed that last part where you tried it directly after "files", too.

Edit: Does the "wins" plugin work at least?

getent -s wins hosts your_windows_host

Last edited by progandy (2018-01-13 10:27:39)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Online

#8 2018-01-13 10:59:33

blarg
Member
Registered: 2018-01-12
Posts: 8

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

ayekat wrote:

OK, last thing: What's the IP addresses of those Windows machines? They don't happen to be in 169.254.0.0/16 range?

Just "192.168.1.11"

progandy wrote:

Are you running systemd-resolved? Then everything after "resolve" will be ignored.

I ran "sudo systemctl status systemd-resolved"

● systemd-resolved.service - Network Name Resolution
   Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-resolved.service(8)
           https://www.freedesktop.org/wiki/Software/systemd/resolved
           https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
           https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
progandy wrote:

Does the "wins" plugin work at least?

getent -s wins hosts your_windows_host

It returned nothing.

Offline

#9 2018-01-13 11:29:26

progandy
Member
Registered: 2012-05-17
Posts: 5,194

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

If I understand it correctly, you'll have to configure and run exactly one WINS server in your network in order to support name resolution for linux. Do you have a computer that is constantly running? linux is fine, you can enable the server with "wins support" in smb.conf.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Online

#10 2018-01-13 12:25:06

blarg
Member
Registered: 2018-01-12
Posts: 8

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

progandy wrote:

If I understand it correctly, you'll have to configure and run exactly one WINS server in your network in order to support name resolution for linux. Do you have a computer that is constantly running? linux is fine, you can enable the server with "wins support" in smb.conf.

Can I just make my current linux computer the WINS server?

I added

wins support = yes

under "[global]" in "/etc/samba/smb.conf" (and restarted everything) but the issue persists.

Last edited by blarg (2018-01-13 12:26:16)

Offline

#11 2018-01-13 13:08:57

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

The wins server needs to be running before the windows client starts (to register there) but if you're running anything that qualifies for a server, you shoud drop this nonsense at once and make it a DNS server (dnsmasq will be sufficient for your purpose) - ideally your router could do that job.
WINS is buggy, deprecated, unmaintained (willfullingly ignoring security issues) - DEAD. Do not use that shit unless you *have* to (what means you're running Win95...)

Offline

#12 2018-01-13 13:51:41

blarg
Member
Registered: 2018-01-12
Posts: 8

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

seth wrote:

ideally your router could do that job.

My main linux machine can ping my raspberry pi (has archlinux too) by its hostname, but I just realised my raspberry pi cannot ping my main linux machine by its hostname. My windows 7 machine can ping both my linux computers and other windows computers.

So I'm thinking there might either be something wrong with the DNS server on the router, or something wrong with my DNS (or is that DHCP?) setup to it on my linux computers. I think I should start looking into that.

seth wrote:

WINS is buggy, deprecated, unmaintained (willfullingly ignoring security issues) - DEAD. Do not use that shit unless you *have* to (what means you're running Win95...)

Ah I see, I'll give up on that.

Last edited by blarg (2018-01-13 14:02:46)

Offline

#13 2018-01-13 14:03:05

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

If you want a quick and easy solution, you're using fixed IPs, and you don't expect much network growth in the future you could just edit the hosts file on all machines to contain the relevant entries.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#14 2018-01-13 14:13:25

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

Do you *have* a DNS server on the router?
(This is supported by OpenWRT, DDWRT and AVM router but most consumer routers to not provide any DNS capabilities)
Public DNS like 8.8.8.8 won't help you resolving local hostnames.

That said, the wins plugin comes with smbclient - it might share only the name of the buggy protocol and just lookup some netbios cache or something. So I've to row back on that criticism.
But the solid, omni-working way to get hostnames resolved is dhcp announcement and DNS - you could maybe turn your raspi into your DNS(masq) server?

Offline

#15 2018-01-13 15:23:06

blarg
Member
Registered: 2018-01-12
Posts: 8

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

Uh I just remembered progandy earlier mentioned the "systemd-resolved" service, I started it and now it's resolving windows hostnames...

thanks for all your help.

edit:

Doesn't seem like there is any use for WINS if you can resolve windows hostnames with "systemd-resolved".

edit2:

Also realised starting avahi-daemon.service, allows me to ping "newcomp.local".

Last edited by blarg (2018-01-13 15:37:30)

Offline

#16 2018-01-13 16:31:38

progandy
Member
Registered: 2012-05-17
Posts: 5,194

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

It seems systemd-resolved provides access to yet another protocol. Amongst others, it has a LLMNR resolver which is supported by windows since vista.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Online

#17 2018-01-13 17:44:28

blarg
Member
Registered: 2018-01-12
Posts: 8

Re: [SOLVED] ping/etc cannot resolve windows machines hostnames

Ah right, I had been reading about mdns and zeroconf which looks to be related (I came across them when trying figure out how windows was resolving hostnames).

Last edited by blarg (2018-01-13 17:44:50)

Offline

Board footer

Powered by FluxBB