I want to set up a local dnsmasq server to resolve local hostnames on my LAN. I'm not (for the moment) concerned with DHCP, just DNS. I'd like to do this without defining a local doman, so that host foo just resolves to foo's IP address. The dnsmasq.conf file appears to allow this because defining a local domain is optional, however it isn't working for me:
$ grep foo /etc/hosts 192.168.1.73 foo $ dig foo
; <<>> DiG 9.10.3-P2-RedHat-9.10.3-7.P2.fc23 <<>> foo ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37194 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION: ;foo. IN A
;; ANSWER SECTION: foo. 30 IN A nnn.nnn.nnn.nnn
(That IP corresponds to some random host somewhere, nothing to do with me).
No doubt this is something very stupid but a hint would be appreciated. Note that I have blocked DNS referrals for unqualified names (option domain-needed)
poc
On Thu, Jan 14, 2016 at 2:20 PM, Patrick O'Callaghan pocallaghan@gmail.com wrote:
I want to set up a local dnsmasq server to resolve local hostnames on my LAN. I'm not (for the moment) concerned with DHCP, just DNS. I'd like to do this without defining a local doman, so that host foo just resolves to foo's IP address. The dnsmasq.conf file appears to allow this because defining a local domain is optional, however it isn't working for me:
$ grep foo /etc/hosts 192.168.1.73 foo $ dig foo
; <<>> DiG 9.10.3-P2-RedHat-9.10.3-7.P2.fc23 <<>> foo ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37194 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION: ;foo. IN A
;; ANSWER SECTION: foo. 30 IN A nnn.nnn.nnn.nnn
(That IP corresponds to some random host somewhere, nothing to do with me).
No doubt this is something very stupid but a hint would be appreciated. Note that I have blocked DNS referrals for unqualified names (option domain-needed)
Looking at "man dnsmasq" but having never tried to create such a setup; so this might be WRONG:
Assuming that your local network is 192.168.1.0 and your local domainname is "poc".
1) If you run dnsmasq on the clients and the server:
- set a domain in your client and server hostname configs
- run dnsmasq on the clients with "--server=/poc/ip_address_of_server --rev-server=192.168.1.0/24,ip_address_of_server"
- run dnsmasq on the server with "--auth-zone=poc --server=/poc/ip_address_of_server --rev-server=192.168.1.0/24,ip_address_of_server"
- list the systems on your network in "/etc/hosts", for example a "192.168.1.111 patrick1.poc patrick1" line for "patrick1"
Running "dig patrick1" (or perhaps "dig patrick1.") on "patrick2" should return "192.168.1.111".
2) If you run dnsmasq on the server:
- set a domain on your clients and server
- set on your clients "/etc/resolv.conf" to point to ip_address_of_server
- run dnsmasq on the server with "--auth-zone=poc --server=/poc/ip_address_of_server"
- list the systems on your network in "/etc/hosts"
On Thu, 2016-01-14 at 15:48 +0100, Tom H wrote:
Assuming that your local network is 192.168.1.0 and your local domainname is "poc".
- If you run dnsmasq on the clients and the server:
set a domain in your client and server hostname configs
run dnsmasq on the clients with "--server=/poc/ip_address_of_server
--rev-server=192.168.1.0/24,ip_address_of_server"
Thanks for replying, but I'm not sure this is what I want:
1) I'm trying not to set any domain, just use local simple (unqualified) names.
2) My understanding of dnsmasq is that it acts as a DNS server (among other things) so there should be no need to run it on the client side as long as the client has a resolver, which they basically all do.
Furthermore, although the man page does talk about lots of command-line options I expect these can all be handled via the config file, which is what I'm trying to do.
Thanks again.
poc
On Thu, Jan 14, 2016 at 5:49 PM, Patrick O'Callaghan pocallaghan@gmail.com wrote:
On Thu, 2016-01-14 at 15:48 +0100, Tom H wrote:
Assuming that your local network is 192.168.1.0 and your local domainname is "poc".
- If you run dnsmasq on the clients and the server:
set a domain in your client and server hostname configs
run dnsmasq on the clients with "--server=/poc/ip_address_of_server
--rev-server=192.168.1.0/24,ip_address_of_server"
Thanks for replying, but I'm not sure this is what I want:
You're welcome.
- I'm trying not to set any domain, just use local simple
(unqualified) names.
How will the resolver know whether "patrick1" (example host from my earlier email) is a meant to be resolved via a local or an upstream server?
- My understanding of dnsmasq is that it acts as a DNS server (among
other things) so there should be no need to run it on the client side as long as the client has a resolver, which they basically all do.
I wasn't sure how you set up your systems, so I gave a (possible) solution with dnsmasq on the clients and one without.
Furthermore, although the man page does talk about lots of command-line options I expect these can all be handled via the config file, which is what I'm trying to do.
I looked for "man dnsmasq.conf" but it doesn't seem to exist.
You can override the Fedora-supplied dnsmasq.service with a systemd drop-in.
I've just downloaded and expanded the dnsmasq rpm. Going through "/etc/dnsmasq.conf", IIUC, for my previous example:
server=/poc/192.168.1.111 server=/1.168.192.in-addr.arpa/192.168.1.111 local=/poc/
Thanks again.
You're welcome.
On Thu, 2016-01-14 at 19:45 +0100, Tom H wrote:
On Thu, Jan 14, 2016 at 5:49 PM, Patrick O'Callaghan pocallaghan@gmail.com wrote:
On Thu, 2016-01-14 at 15:48 +0100, Tom H wrote:
Assuming that your local network is 192.168.1.0 and your local domainname is "poc".
- If you run dnsmasq on the clients and the server:
set a domain in your client and server hostname configs
run dnsmasq on the clients with "
--server=/poc/ip_address_of_server --rev-server=192.168.1.0/24,ip_address_of_server"
Thanks for replying, but I'm not sure this is what I want:
You're welcome.
- I'm trying not to set any domain, just use local simple
(unqualified) names.
How will the resolver know whether "patrick1" (example host from my earlier email) is a meant to be resolved via a local or an upstream server?
Because that's what domain-needed does. It will only try to resolve upstream if the name has a domain part.
[...]
I've just downloaded and expanded the dnsmasq rpm. Going through "/etc/dnsmasq.conf", IIUC, for my previous example:
server=/poc/192.168.1.111 server=/1.168.192.in-addr.arpa/192.168.1.111 local=/poc/
That appears to work. I guess I have to read the docs more carefully.
Thanks again.
poc