OPNsense Forum

Archive => 21.1 Legacy Series => Topic started by: verasense on March 15, 2021, 03:28:46 PM

Title: DNS without domain
Post by: verasense on March 15, 2021, 03:28:46 PM
I used the "Register DHCP static mappings" to get the computer names into the DNS.

However:
ping computer1 cannot be resolved
But:
ping computer1.domain can.

Is there a way to allow DNS request without the domain?
Title: Re: DNS without domain
Post by: wurmloch on March 15, 2021, 09:48:35 PM
Hi verasense,

maybe this depends on your client's operating system, too. Tell us about this and post the error messages of the two following commands:

ping <name>
nslookup <name>

Regards, Uwe
Title: Re: DNS without domain
Post by: verasense on March 16, 2021, 09:50:58 AM
I am using Windows 10. The ping with the domain accesses the WAN address:

ping computer1
Ping request could not find host computer1. Please check the name and try again.

ping computer1.domain

Pinging computer1.domain[xx.xx.xx.xx] with 32 bytes of data:
Reply from xx.xx.xx.xx: bytes=32 time<1ms TTL=64
Reply from xx.xx.xx.xx: bytes=32 time<1ms TTL=64
...

nslookup computer1
Server:  computer1.domain
Address:  10.1.1.1

Name:    computer1
Addresses:  xx.xx.xx.xx
          192.168.10.1
          10.1.1.1
          192.168.0.1
Title: Re: DNS without domain
Post by: marjohn56 on March 16, 2021, 10:34:55 AM
Works on my system, just pinged the wife's pc just by hostname which does not have a dns override or static mapping.
Title: Re: DNS without domain
Post by: verasense on March 16, 2021, 12:41:53 PM
What can be the reason for mine not to work?
Title: Re: DNS without domain
Post by: wurmloch on March 16, 2021, 01:28:00 PM
Maybe the connection related / connection specific DNS-Suffix of your LAN/W-LAN connection of Windows 10? Your Client could or should attach ".domain" to "computer1" before pinging oder dns lookups. Inspect your network settings, maybe this helps or adapt your settings in the DHCP service static mappings.
Title: Re: DNS without domain
Post by: verasense on March 16, 2021, 08:01:14 PM
You are right.

I tested it on Linux and it worked, it's not opnsense related.

On Windows, I could fix it via:
System - Advanced system settings - Computer Name - Change - More
and set "domain" in Primary DNS suffix of this computer.

Alternatively, this can aslo be done in the TCP/IP properties of the specific interface from the "Network Connections".

It is not the cleanest solution, as it is input manually and not obtained dynamically from the network.
I have the "Change primary DNS suffix..." option enabled so I am not sure why it is not picking the domain name from the DNS server. And I assigned a static DHCP lease, so it is supposed to get the domain from there...

See also: https://serverfault.com/questions/44030/local-dns-not-resolving-host-name-but-will-resolve-fqdn
Title: Re: DNS without domain
Post by: wurmloch on March 16, 2021, 08:30:30 PM
Well, in general the client operating system should apply the domain suffix provided by the dhcp server. Opnsense offers this as default. Nevertheless in dhcp service setting you can explicitly specify in the field ,,domain" your domainname. Give it a try. And on windows cmd type ,,ipconfig -release" and ,,ipconfig -renew" to apply changes in dhcp Config. I agree, the a mix of dhcp Mapping and manually specified information is not good.

Somewhere above you spoke about ,,the Ping with the domain accesses the wan address" I do not understand this sentence.

And from my experience: keep your DNS in your network, on your servers and clients 100% correct, I repeat, 100%! Especially when windows is part of the game. And keep in mind that windows uses different mechanisms to resolve ip addresses for Ping and nslookup.

It's a good strategy to use different operating systems for testing :-)

And you can check opnsense unbound by using Interfaces: Diagnostics: DNS Lookup

Good luck, Uwe
Title: Re: DNS without domain
Post by: verasense on March 18, 2021, 02:33:32 AM
Thanks for your help.

What I meant with "the Ping with the domain accesses the wan address" is that the ping command with explicit domain was using the WAN address out of all router addresses.
So, the router has 4 addresses (xx.xx.xx.xx, 192.168.10.1, 10.1.1.1, 192.168.0.1) and by using "ping computer1.domain" Windows used the WAN address out of them:
"Pinging computer1.domain[xx.xx.xx.xx] with 32 bytes of data:"

Maybe Windows picked this address at random from the DNS responses.