Case sensitivity in dnsmasq & /etc/hosts ?

Support section for FREESCO v0.4.x

Case sensitivity in dnsmasq & /etc/hosts ?

Postby Island » Sun Apr 20, 2014 6:08 am

I have noticed that dnsmasq, if it is looking up a name that has any upper-case characters (eg 'F20desktop', the hostname for a desktop machine on our LAN) in the request, is not returning that host's entry in /etc/hosts

Code: Select all
/etc/hosts
192.168.3.20 <tab> f20desktop <tab> F20desktop <tab> F20desktop.mydomain.org


but, instead, is checking the external DNS provider (Google DNS in this example case) for a resolution

Code: Select all
Apr 20 10:44:06 - dnsmasq[6267]: query F20desktop.mydomain.org from 192.168.3.10
Apr 20 10:44:06 - dnsmasq[6267]: forwarded F20desktop.mydomain.org to 8.8.8.8
Apr 20 10:44:06 - dnsmasq[6267]: query F20desktop.mydomain.org from 192.168.3.10
Apr 20 10:44:06 - dnsmasq[6267]: config F20desktop is <NODATA>-IPv6


(Additionally, in this instance, F20desktop cannot resolve externally because there are no A records, or CNAMEs, for that host in the DNS records for this domain.)

In other cases of local hostname resolutions, where the resolution request for the local hostname is in lower case, then dnsmasq returns the entry from /etc/hosts without difficulty. (And, because I had expected resolution for all our local hostnames from /etc/hosts, irrespective of how typed in any resolution request, I had not set any local hostnames in the DNS records for our domain. I have inserted both uc and lc versions of each hostname in the /etc/hosts file, but this does not seem to help dnsmasq resolve the host name.)

I'm wondering if I've created this problem by careless choice of each host's name. Are hostnames expected to be lower case? Would dnsmasq be expected not to look up a hostname in /etc/hosts, if that name contains upper case characters?

regards, Island
User avatar
Island
Junior Advanced Member
 
Posts: 117
Joined: Sat Jan 22, 2005 12:48 pm

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Lightning » Sun Apr 20, 2014 12:41 pm

My first question would be how are you making the entries and what version of FREESCO are you using?

I ran a "Test" on my own machine and it resolved fine. But I am using 0.4.5 and I put the entry into the dns.cfg and restarted the DNS server with "rc_dns restart" and the entry in like

xx.xx.xx.xx <TAB> Test <TAB> Test.inet

You also need to be certain that your client isn't bypassing FREESCO for some URL's. So set the DNS server in "e" mode when trying the tests and use "rc_masq restart" after the setting is in place.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Island » Sun Apr 20, 2014 1:27 pm

Set the hosts file (or whatever file 'setup' presents, it looks like the hosts file) during 'setup, servers, DNS server', saved the edit, saved the config change at the end of 'setup', and stopped and restarted DNS server from the control panel. DNS service is set to 'e' (and the log extract is from FREESCO).

I wondered whether the version may matter - this is on 0.4.4. From your reply, I think resolution requests with upper case in the hostname, and upper case in the entry in /etc/hosts, should work.

I've just tried a direct resolution on the FREESCO login, eg
Code: Select all
[root@router44] ping F20desktop
PING F20desktop (192.168.3.20): 56 data bytes
64 bytes from 192.168.3.20: icmp_seq=0 ttl=64 time=0.5 ms
64 bytes from 192.168.3.20: icmp_seq=1 ttl=64 time=0.1 ms
64 bytes from 192.168.3.20: icmp_seq=2 ttl=64 time=0.1 ms
64 bytes from 192.168.3.20: icmp_seq=3 ttl=64 time=0.1 ms
64 bytes from 192.168.3.20: icmp_seq=4 ttl=64 time=0.1 ms
[ ... ]
64 bytes from 192.168.3.20: icmp_seq=5 ttl=64 time=0.1 ms
--- F20desktop ping statistics ---
15 packets transmitted, 15 packets received, 0% packet loss
round-trip min/avg/max = 0.0/0.1/0.5 ms
[root@router44]

which is something I hadn't tried, before. Resolving perfectly, just as your test did.

My problem must be subtler than I've defined. These requests are coming from other hosts on the LAN, some of them may be 'self lookups' of what their own hostname resolves to (and every 30 mins, exactly, and I'm not sure why they do that); I'll do some more checks and try to narrow things down. It only happens with hosts whose name contains - and, actually, begins with - an upper case character. Hosts with lower case names resolve locally anyway.

There is one point, I've realised. FREESCO is named router44 and its domain name is, I think inet. These hosts are using mydomain.org as their domain name, I wonder if that is confusing things. More to check.

Thanks for the reply,

regards, Island
User avatar
Island
Junior Advanced Member
 
Posts: 117
Joined: Sat Jan 22, 2005 12:48 pm

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Lightning » Sun Apr 20, 2014 3:10 pm

FREESCO will resolve it's own name of mydomain.org, but will not resolve internal clients of xxx.mydomain.org.
What you will need to do is to add each internal client in the DNS configuration file manually with

xx.xx.xx.xx <TAB> client.mydomain.org

Where xx.xx.xx.xx is there internal IP address. This is of course assuming these internal clients have static DHCP leases or they are set to a static IP.

As for the version being a factor, the daemon is the the same from 0.4.4 to 0.4.5, but the flags it is started with are different in "/rc/rc_dns". However this would only effect URL's with the domain extension of .inet
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Island » Sun Apr 20, 2014 4:50 pm

Lightning wrote:FREESCO will resolve it's own name of mydomain.org, but will not resolve internal clients of xxx.mydomain.org.
What you will need to do is to add each internal client in the DNS configuration file manually with

xx.xx.xx.xx <TAB> client.mydomain.org



Lewis, your note suggest that FREESCO needs additional entries for hosts within the domain that FREECO is a member of; that's accepted and ok, but is not the situation here, I think (please correct me if you disagree). The issue I think I face is this:

The domain that FREESCO is aware of is 'inet' ; FREESCO hostname is router44 and domain inet
The domain that LAN clients are aware of is 'mydomain.org' ; hosts are eg F20desktop and domain mydomain.org.

so the additional hosts, that require entries, are for a domain that differs from FREESCO's domain name. (I thnk this may be an important mistake in my FREESCO setup, and my LAN setup.) My /etc/hosts already had client.mydomain.org entries in it, but those are not client.inet which is what FREESCO is comfortable with.

I'll do some more checks tomorrow - one check I will do is to change the domain that FREESCO assumes to 'mydomain.org'. And some others, such as the actual coding of the host names and domain names on the other machines on the LAN.

Thanks, very much, for the guidance, and I'll post back.

regards, Island
User avatar
Island
Junior Advanced Member
 
Posts: 117
Joined: Sat Jan 22, 2005 12:48 pm

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Lightning » Sun Apr 20, 2014 8:06 pm

I will do is to change the domain that FREESCO assumes to 'mydomain.org'.
In general changing FREESCO's domain to .org would be a mistake. However if done using mydomain.org as the domain with a hostname in front would probably work. The reason is because at this point anything with an ending of mydomain.org should resolve locally if there is a host name for it.
Under normal circumstances all internal clients would use .inet as there domain and there name should never resolve to an IP address except from within the LAN. This helps in security of the LAN and keeps everything much clearer.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Island » Mon Apr 21, 2014 6:16 am

Update on various tests.

(i) Changed FREESCO's domain to 'mydomain.org' using setup (FREESCO remonstrated, both citing your warning, and then admonishing me for seeming not to have read it :) ) but the change did not seem to make a difference. In any case, another resolution request from a LAN machine does not append a domain name and asks, simply, to resolve its own server name "F20server" and this request, also, FREESCO forwarded to Google DNS. So, changing FREESCO's domain name would not make a difference in our LAN setup.

(ii) Changed the 'order', on each line of dns.cfg, of the host names, placing hostnames with upper case to the left of the hostnames without upper case. (I should explain, because I cannot remember whether any of the hostnames are using uppercase letters to start, I had entered both f20server and F20server on a single line in dns.cfg.) DNSmasq now seems to resolve the hostnames with upper case, either when they have a domain name added, or when the name stands alone (the dns.cfg still has both the hostname, and the fully qualified name, on each line, in case different LAN machines append 'mydomain.org' to their request - one machine certainly does seem to). Seemingly, then, the order in which hostnames, that differ only in letter case, matters, with the uppercase names appearing left/first on the line.

[Update edit: This may or may not have had an effect; DNS still behaving oddly.]

Lightning wrote:Under normal circumstances all internal clients would use .inet as there domain and there name should never resolve to an IP address except from within the LAN. This helps in security of the LAN and keeps everything much clearer.


This interested me. I'd certainly like to keep the LAN as secure as possible. We have various servers and desktops built with Debian and, at install time, Debian asks the user to provide a hostname, and, then, a domain name. If we hadn't had a domain name then I think, from what you say, 'inet' might be a good choice there. But since we have a domain name I'd assumed that Debian needed it for some of the services that might be employed, and so we entered 'mydomain.org' there. (This is why one of the machines is asking FREESCO to resolve 'F20desktop.mydomain.org'.)

I'm a little unsure, now, how machines should be configured, in the light of your advice (on which I place some value, by the way). Whether to use 'inet', or to use 'mydomain.org' on new machines. This is off-topic for our original post in this thread, but I would be interested in any more thoughts about the rights and wrongs of this entry.

Back to the main issue. I'll keep an eye on the logs for instances of failure to resolve locally; I'm hoping that this oddity in respect of letter-case in hostnames might be fixed.

regards, Island
User avatar
Island
Junior Advanced Member
 
Posts: 117
Joined: Sat Jan 22, 2005 12:48 pm

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Lightning » Mon Apr 21, 2014 9:51 am

The "right way" to configure any local machine would be to use "inet" as there domain. The only thing that the domain is used for on local machines is for DNS resolution to know what machines are local and what machines need to be asked for from an outside DNS server. The domain is also appended to it's host name to know it's FQDN. Which again should never resolve outside the LAN for local machines. If you look for /etc/resolv.conf on these newer Linux based machines you will see and can modify the domain name.
You also might benefit from the v0.4.5 rc_dns script which is made a little different than previous version and will never forward a local domain even if it is asked for and won't resolve.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Island » Mon Apr 21, 2014 10:35 am

Lightning wrote:The "right way" to configure any local machine would be to use "inet" as there domain. The only thing that the domain is used for on local machines is for DNS resolution to know what machines are local and what machines need to be asked for from an outside DNS server.


Right; I need to understand and fix this, because I think the problems I'm getting might be related to my having setup the wrong domain names on the LAN machines. (The problems seem mostly to derive from machines trying to look 'themselves' up in DNS.) May I stick with your remark, for a moment, and ask a further clarification?

I wanted to use FREESCO's DNS resolver as the name server for the LAN. I mean, I want it to resolve all the local machine names for anyone who asks from the LAN. Q1: Is this a reasonable expectation, or should I, instead, use a common hosts file on all LAN machines? I would prefer to have a single name resolver (eg, FREESCO) for all the machines on the LAN (and they all have fixed IPs, incidentally).

If I can hope to use FREESCO as a LAN machine name resolver, I need each machine on the LAN to ask FREESCO to resolve any name. Q2: will the machines do that if I use 'inet' as a domain? I was not sure I quite understood what you were getting at when you explained that 'inet' indicates that the machines should not be looked up from outside.
Q2a: Did you mean that using 'inet' on a LAN machine will tell FREESCO (when FREESCO also has 'inet' as its domain) that it (FREESCO) shouldn't go to an external resolver?

Lastly, Q3: if we revert to using 'inet' can I still put the fully qualified names of some of our servers (eg mail.mydomain.org) in the FREESCO dns.cfg, as well, and on the appropriate line, so that MUAs on mobile devices (for example) can resolve quickly to local servers when they are connected to the LAN via wifi? We're doing this at the moment, and it seems to work ok, so I'm guessing it's a reasonable approach.

Apologies for the basic question. (I have been looking at man resolv.conf on a recent Debian installation, as well, and it talks about order of searching and the use of domains but I think I've only part-understood what's going on, as you can see.)

regards, Island
User avatar
Island
Junior Advanced Member
 
Posts: 117
Joined: Sat Jan 22, 2005 12:48 pm

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Island » Mon Apr 21, 2014 10:43 am

Lightning wrote:You also might benefit from the v0.4.5 rc_dns script which is made a little different than previous version and will never forward a local domain even if it is asked for and won't resolve.


I wondered, because I saw some related issues in the other DNS resolution thread and noticed that you had thought it could help. I'll re-download the current released version of 0.4.5.

regards, Island
User avatar
Island
Junior Advanced Member
 
Posts: 117
Joined: Sat Jan 22, 2005 12:48 pm

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Island » Mon Apr 21, 2014 11:05 am

Back to the main problem, this is the problem I have. Extract from 'recent log' on FREESCO 0.4.4:

Code: Select all
Apr 21 16:44:22 - dnsmasq[3812]: query F20desktop.mydomain.org from 192.168.3.40
Apr 21 16:44:22 - dnsmasq[3812]: forwarded F20desktop.mydomain.org to 8.8.4.4
Apr 21 16:44:22 - dnsmasq[3812]: query F20desktop from 192.168.3.40
Apr 21 16:44:22 - dnsmasq[3812]: config F20desktop is <NODATA>-IPv6
Apr 21 16:46:23 - dnsmasq[3812]: query F20desktop.mydomain.org from 192.168.3.40
Apr 21 16:46:23 - dnsmasq[3812]: /etc/hosts F20desktop.mydomain.org is 192.168.3.40


The request at 1644 was 'automatic', some daemon running in current Debian version. Seems to run every 30 mins, and seems to look itself up. Note that FREESCO doesn't resolve it, but forwards it to Google.

The request at 1646 resulted from my typing nslookup F20desktop.mydomain.org at the command line. On this try, FREESCO resolves the request from /etc/hosts. This seems to be the pattern: command line invocations resolve, 'automatic' requests seem to fail. I wonder whether some additional parameter is being sent, with those, in the DNS lookup request?

Odd. I cannot work out what is happening, here. And it is the same behaviour as before I changed FREESCO's domain name to 'mydomain.org'; I'm going to change that back, it hasn't made any difference and seems to have been the wrong move.

(The second request at 1644 must have been for an IPv6 AAAA record - I will set our machines to suppress those, they are just cluttering up the logs at the moment.)

regards, Island
User avatar
Island
Junior Advanced Member
 
Posts: 117
Joined: Sat Jan 22, 2005 12:48 pm

Re: Case sensitivity in dnsmasq & /etc/hosts ?

Postby Lightning » Mon Apr 21, 2014 2:19 pm

Island wrote:I wanted to use FREESCO's DNS resolver as the name server for the LAN. I mean, I want it to resolve all the local machine names for anyone who asks from the LAN. Q1: Is this a reasonable expectation, or should I, instead, use a common hosts file on all LAN machines? I would prefer to have a single name resolver (eg, FREESCO) for all the machines on the LAN (and they all have fixed IPs, incidentally).
Yes, very reasonable. But be aware there is other name type queries on the network from Windows machines that DNS will never resolve. Such as the network neighborhood domain that would require Samba installed on the router as well.
If I can hope to use FREESCO as a LAN machine name resolver, I need each machine on the LAN to ask FREESCO to resolve any name. Q2: will the machines do that if I use 'inet' as a domain? I was not sure I quite understood what you were getting at when you explained that 'inet' indicates that the machines should not be looked up from outside.
Q2a: Did you mean that using 'inet' on a LAN machine will tell FREESCO (when FREESCO also has 'inet' as its domain) that it (FREESCO) shouldn't go to an external resolver?

IF you use "inet" as the domain name for FREESCO and ALL other internal machines AND you use the 0.4.5 version of the "rc_dns". Then any name that ends in .inet will never be forwarded to any opther DNS server and FREESCO will resolve them it's self.
Lastly, Q3: if we revert to using 'inet' can I still put the fully qualified names of some of our servers (eg mail.mydomain.org) in the FREESCO dns.cfg, as well, and on the appropriate line, so that MUAs on mobile devices (for example) can resolve quickly to local servers when they are connected to the LAN via wifi? We're doing this at the moment, and it seems to work ok, so I'm guessing it's a reasonable approach.

That is exactly the right way to do it.
Apologies for the basic question. (I have been looking at man resolv.conf on a recent Debian installation, as well, and it talks about order of searching and the use of domains but I think I've only part-understood what's going on, as you can see.)

regards, Island

None of these questions are really basic in nature and if you read my signature you will understand my beliefs. When you do something the wrong way you will learn hundreds of times more than if you do it the right way.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA


Return to FREESCO Support for v0.4.x

Who is online

Users browsing this forum: No registered users and 3 guests

cron