Unable to resolve Windows LAN hostnames

Having issues with your DietPi installation, or, found a bug? Post it here.
Mattie

Re: Unable to resolve Windows LAN hostnames

Post by Mattie »

I installed fresh, and exited the dietpi-software that auto-launches after the 103 update:

Code: Select all

root@DietPi:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 84.116.46.22
nameserver 84.116.46.23

#/etc/network/interfaces

# Local
auto lo
iface lo inet loopback

# Ethernet
auto eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 8.8.8.8 8.8.4.4

# Wifi
#auto wlan0
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wireless-essid FuzonWifi
wireless-key abcde12345
wireless-mode Managed
wireless-power off
wpa-ssid FuzonWifi
wpa-psk abcde12345
#dns-nameservers 8.8.8.8 8.8.4.4

These look much better, I will continue to do what i normally do in order to see at what point it goes wrong
Mattie

Re: Unable to resolve Windows LAN hostnames

Post by Mattie »

Ok, after that I did a reboot and the setup resumed with a message that i had no internet connection.
Checking resolv.conf again and it was gone again.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Unable to resolve Windows LAN hostnames

Post by Fourdee »

Mattie wrote:Ok, after that I did a reboot and the setup resumed with a message that i had no internet connection.
Checking resolv.conf again and it was gone again.
Thanks Mattie,

Looks like an possible issue with your router and DHCP.
The router is giving an external IP of 84.116.46.22 for DNS, instead of its own IP address. This is why you can't ping local machines because your router is forcing your device to resolve DNS outside your local network.
As for why resolv.conf is empty after the 2nd reboot, no idea. I tested on my own network to verify, works everytime.

The only thing I can suggest to resolve this issue is use a static IP address on your device, which allows us to define DNS server:
- run dietpi-config
- networking options
- select ethernet
- select " Copy Copy Current address to Static"
- change "Static DNS" to match your Static Gateway address.
- Apply settings "Save Changes".

Now try to run your ping tests.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Mattie

Re: Unable to resolve Windows LAN hostnames

Post by Mattie »

In windows all my machines automatically get the routers ip as dns... in dietpi i get the google dns, which i have not configured anywhere myself.
As for the nameserver part, I don't think it's a router "issue", more of a feature... My router does not support naming devices, so pinging hostnames is purely based on windows netbios, hence the need for wins.

As for the resolv.conf going missing... I just tested it with dietpi v94 and it remains after reboot, as it also did on my v102, after installing it manually. Must still be a change in v103 that causes it I guess?
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Unable to resolve Windows LAN hostnames

Post by Fourdee »

Mattie wrote:in dietpi i get the google dns, which i have not configured anywhere myself.
Assuming your talking about resolv.conf, thats because resolvconf was not installed prior to v103. Resolv.conf was never being updated. This was a "bug" in DietPi. Its a miracle that this "bug" was actually giving you a "fix" :)
Mattie wrote:after installing it manually. Must still be a change in v103 that causes it I guess?
I just checked the patch code. If you had DHCP active during the patch, the only trigger is:

Code: Select all

apt-get install resolvconf -y
As this is exactly the same as what you did, it doesn't appear to be an issue with the patch.
I don't think it's a router "issue", more of a feature... My router does not support naming devices
If thats the case, you should consider using static IP's instead of hostnames.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Mattie

Re: Unable to resolve Windows LAN hostnames

Post by Mattie »

Fourdee wrote:
Mattie wrote:in dietpi i get the google dns, which i have not configured anywhere myself.
Assuming your talking about resolv.conf, thats because resolvconf was not installed prior to v103. Resolv.conf was never being updated. This was a "bug" in DietPi. Its a miracle that this "bug" was actually giving you a "fix" :)
No i meant in my interfaces. I don't know where they are from other than they are preset in dietpi?
I assumed it had something to do with the new feature of 103 to set static dns now as well.
What creates the resolv.conf prior to this fix? As in v94 I had the correct nameservers in resolv.conf as well.
Fourdee wrote:
I don't think it's a router "issue", more of a feature... My router does not support naming devices
If thats the case, you should consider using static IP's instead of hostnames.
I set static leases in my router, but use the hostnames for everything. I do not mind installing winbinds to get that working.

Would a fix for me be uninstalling resolvconf after installing 103, and manually setting the vallues in that file?

I'm very new to linux and everything i do is stitching together different tutorials on internet.
I fail to understand what the differences are with having dns entries on the interface, and the use of the resolv.conf file.

(On another note, I'm having a new router for chrismass, which might also solve all these issues :P)
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Unable to resolve Windows LAN hostnames

Post by Fourdee »

Mattie wrote: No i meant in my interfaces.
The dns-nameserver will be commented out with a hash at the start (# which means disabled) for DHCP. DietPi-Config > Networking will do this automatically for you when using it to setup network.
Would a fix for me be uninstalling resolvconf after installing 103, and manually setting the vallues in that file?
Yep, that would work for /etc/resolv.conf. If you are running Jessie, you could try disable/enable the service:

Code: Select all

systemctl disable resolvconf
EDIT: Ideally, its better practice to just set dns-nameserver in /etc/network/interfaces. This will override resolv.conf
For ethernet with DHCP:

Code: Select all

# Ethernet
auto eth0
iface eth0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
#The below is google DNS nameservers. Put a hash sign before dns-nameservers to disable
dns-nameservers 8.8.8.8 8.8.4.4
Reboot system once done.

I'm very new to linux and everything i do is stitching together different tutorials on internet.
I fail to understand what the differences are with having dns entries on the interface, and the use of the resolv.conf file.
When you are running DHCP:
The IP entries in /etc/network/interfaces are ignored. Resolv.conf is then updated with the DNS server it pulled from your router. You can override the resolv.conf values by enabling dns-nameserver in /etc/network/interfaces

If your running STATIC IP
All the IP settings from /etc/network/interfaces will be used. Resolv.conf is no longer used. dns-nameserver value from /etc/network/interfaces will be used, and, must be enabled.
(On another note, I'm having a new router for chrismass, which might also solve all these issues :P)
Hopefully it should, depends on which one santa is going to give you. Just dont be naughty or you'll end up with a coal powered router. I've had coal powered stuff in the past :D
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Mattie

Re: Unable to resolve Windows LAN hostnames

Post by Mattie »

Thanks for all the help so far, I will try those solutions, see what i like best.
Perhaps switch to jessie as i want to use the let's encrypt stuff as well.

As for the router, it will be a TP-Link TL-WR1043ND

cheers
Post Reply