Post History
What you describe is a typical mixed authoritative/recursive resolver setup. Such a DNS server setup will respond from its own data about zones for which it has explicit configuration, and will per...
Answer
#3: Post edited
**What you describe is a typical mixed authoritative/recursive resolver setup.**- Exactly how to set it up depends on the DNS server software you're running; for example, `BIND` is going to be different from `dnsmasq` is going to be different from `Unbound`. The general approach, however, is the same. (It's also worth noting that no proper DNS server will see host names listed in `/etc/hosts`.)
- First, set up your choice of DNS server software in a "recursive resolver" configuration. [For example, with BIND](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-allow-recursion), you'll likely want to add something like `allow-recursion { 192.168.1.0/24; };` to the `options {}` block of your `named.conf`. Take care to not enable recursion for hosts that should not be allowed to use your DNS resolver for recursive queries.
- Second, choose a zone in which to group your local hosts, and add that. If you don't know what zone name to choose, I strongly recommend `home.arpa` ([RFC 8375](https://tools.ietf.org/html/rfc8375)). Again, with BIND as an example, add to `named.conf` *outside* of the `options {}` block a [`zone`](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-zone) block:
- zone "home.arpa" {
- type master;
- allow-transfer { none; };
- file "home.arpa.db";
- };
- Then create a `home.arpa.db` file which lists the hosts in question. The simplest incarnation of this can be something similar to:
- @ SOA ns . 1 300 300 2592000 30
- @ NS ns
- ns A 192.168.1.123 ; the IP address of your DNS server machine
- phone A 192.168.1.99
- desktop A 192.168.1.33
- printer A 192.168.1.44
- laptop A 192.168.1.55
- ; ... and so on ...
- If you are only running a single DNS server for the zone, the only number in the `SOA` record that really matters is the last one, which is the negative response time-to-live (expressed in seconds); it controls how long "no such host" responses are cached by caching downstream resolvers. The first number in the `SOA` record (the `1`) is the zone serial number; increment it when you make changes to the zone data.
- Once you have the DNS zone set up, perform whatever magic is required to make your DNS server software (re)load it. Again BIND as an example, this might be `rndc reload`. Check your system logs to ensure that no errors are reported.
- You can then experiment a little with `dig` to check that things are working properly (`+norec` means "no recursion"; `+short` causes printing only of the relevant portion of the response, in this case an IPv4 address since we ask for `A` records):
- $ dig @192.168.1.123 phone.home.arpa a +short +norec
- 192.168.1.99
- $ dig @192.168.1.123 linux.codidact.com a +short
- ...
- $
- This can be expanded upon to allow for example dynamic updates, but if you are contemplating using `/etc/hosts`, the above will get you much the same results.
- **What you describe is a typical mixed authoritative/recursive resolver setup.** Such a DNS server setup will respond from its own data about zones for which it has explicit configuration, and will perform recursive resolution for any other names on behalf of clients.
- Exactly how to set it up depends on the DNS server software you're running; for example, `BIND` is going to be different from `dnsmasq` is going to be different from `Unbound`. The general approach, however, is the same. (It's also worth noting that no proper DNS server will see host names listed in `/etc/hosts`.)
- First, set up your choice of DNS server software in a "recursive resolver" configuration. [For example, with BIND](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-allow-recursion), you'll likely want to add something like `allow-recursion { 192.168.1.0/24; };` to the `options {}` block of your `named.conf`. Take care to not enable recursion for hosts that should not be allowed to use your DNS resolver for recursive queries.
- Second, choose a zone in which to group your local hosts, and add that. If you don't know what zone name to choose, I strongly recommend `home.arpa` ([RFC 8375](https://tools.ietf.org/html/rfc8375)). Again, with BIND as an example, add to `named.conf` *outside* of the `options {}` block a [`zone`](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-zone) block:
- zone "home.arpa" {
- type master;
- allow-transfer { none; };
- file "home.arpa.db";
- };
- Then create a `home.arpa.db` file which lists the hosts in question. The simplest incarnation of this can be something similar to:
- @ SOA ns . 1 300 300 2592000 30
- @ NS ns
- ns A 192.168.1.123 ; the IP address of your DNS server machine
- phone A 192.168.1.99
- desktop A 192.168.1.33
- printer A 192.168.1.44
- laptop A 192.168.1.55
- ; ... and so on ...
- If you are only running a single DNS server for the zone, the only number in the `SOA` record that really matters is the last one, which is the negative response time-to-live (expressed in seconds); it controls how long "no such host" responses are cached by caching downstream resolvers. The first number in the `SOA` record (the `1`) is the zone serial number; increment it when you make changes to the zone data.
- Once you have the DNS zone set up, perform whatever magic is required to make your DNS server software (re)load it. Again BIND as an example, this might be `rndc reload`. Check your system logs to ensure that no errors are reported.
- You can then experiment a little with `dig` to check that things are working properly (`+norec` means "no recursion"; `+short` causes printing only of the relevant portion of the response, in this case an IPv4 address since we ask for `A` records):
- $ dig @192.168.1.123 phone.home.arpa a +short +norec
- 192.168.1.99
- $ dig @192.168.1.123 linux.codidact.com a +short
- ...
- $
- This can be expanded upon to allow for example dynamic updates, but if you are contemplating using `/etc/hosts`, the above will get you much the same results.
#2: Post edited
- **What you describe is a typical mixed authoritative/recursive resolver setup.**
- Exactly how to set it up depends on the DNS server software you're running; for example, `BIND` is going to be different from `dnsmasq` is going to be different from `Unbound`. The general approach, however, is the same. (It's also worth noting that no proper DNS server will see host names listed in `/etc/hosts`.)
- First, set up your choice of DNS server software in a "recursive resolver" configuration. [For example, with BIND](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-allow-recursion), you'll likely want to add something like `allow-recursion { 192.168.1.0/24; };` to the `options {}` block of your `named.conf`. Take care to not enable recursion for hosts that should not be allowed to use your DNS resolver for recursive queries.
- Second, choose a zone in which to group your local hosts, and add that. If you don't know what zone name to choose, I strongly recommend `home.arpa` ([RFC 8375](https://tools.ietf.org/html/rfc8375)). Again, with BIND as an example, add to `named.conf` *outside* of the `options {}` block a [`zone`](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-zone) block:
- zone "home.arpa" {
- type master;
- allow-transfer { none; };
- file "home.arpa.db";
}- Then create a `home.arpa.db` file which lists the hosts in question. The simplest incarnation of this can be something similar to:
- phone A 192.168.1.99
- desktop A 192.168.1.33
- printer A 192.168.1.44
- laptop A 192.168.1.55
- ; ... and so on ...
- Once you have the DNS zone set up, perform whatever magic is required to make your DNS server software (re)load it. Again BIND as an example, this might be `rndc reload`. Check your system logs to ensure that no errors are reported.
- You can then experiment a little with `dig` to check that things are working properly (`+norec` means "no recursion"; `+short` causes printing only of the relevant portion of the response, in this case an IPv4 address since we ask for `A` records):
- $ dig @192.168.1.123 phone.home.arpa a +short +norec
- 192.168.1.99
- $ dig @192.168.1.123 linux.codidact.com a +short
- ...
- $
- This can be expanded upon to allow for example dynamic updates, but if you are contemplating using `/etc/hosts`, the above will get you much the same results.
- **What you describe is a typical mixed authoritative/recursive resolver setup.**
- Exactly how to set it up depends on the DNS server software you're running; for example, `BIND` is going to be different from `dnsmasq` is going to be different from `Unbound`. The general approach, however, is the same. (It's also worth noting that no proper DNS server will see host names listed in `/etc/hosts`.)
- First, set up your choice of DNS server software in a "recursive resolver" configuration. [For example, with BIND](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-allow-recursion), you'll likely want to add something like `allow-recursion { 192.168.1.0/24; };` to the `options {}` block of your `named.conf`. Take care to not enable recursion for hosts that should not be allowed to use your DNS resolver for recursive queries.
- Second, choose a zone in which to group your local hosts, and add that. If you don't know what zone name to choose, I strongly recommend `home.arpa` ([RFC 8375](https://tools.ietf.org/html/rfc8375)). Again, with BIND as an example, add to `named.conf` *outside* of the `options {}` block a [`zone`](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-zone) block:
- zone "home.arpa" {
- type master;
- allow-transfer { none; };
- file "home.arpa.db";
- };
- Then create a `home.arpa.db` file which lists the hosts in question. The simplest incarnation of this can be something similar to:
- @ SOA ns . 1 300 300 2592000 30
- @ NS ns
- ns A 192.168.1.123 ; the IP address of your DNS server machine
- phone A 192.168.1.99
- desktop A 192.168.1.33
- printer A 192.168.1.44
- laptop A 192.168.1.55
- ; ... and so on ...
- If you are only running a single DNS server for the zone, the only number in the `SOA` record that really matters is the last one, which is the negative response time-to-live (expressed in seconds); it controls how long "no such host" responses are cached by caching downstream resolvers. The first number in the `SOA` record (the `1`) is the zone serial number; increment it when you make changes to the zone data.
- Once you have the DNS zone set up, perform whatever magic is required to make your DNS server software (re)load it. Again BIND as an example, this might be `rndc reload`. Check your system logs to ensure that no errors are reported.
- You can then experiment a little with `dig` to check that things are working properly (`+norec` means "no recursion"; `+short` causes printing only of the relevant portion of the response, in this case an IPv4 address since we ask for `A` records):
- $ dig @192.168.1.123 phone.home.arpa a +short +norec
- 192.168.1.99
- $ dig @192.168.1.123 linux.codidact.com a +short
- ...
- $
- This can be expanded upon to allow for example dynamic updates, but if you are contemplating using `/etc/hosts`, the above will get you much the same results.
#1: Initial revision
**What you describe is a typical mixed authoritative/recursive resolver setup.** Exactly how to set it up depends on the DNS server software you're running; for example, `BIND` is going to be different from `dnsmasq` is going to be different from `Unbound`. The general approach, however, is the same. (It's also worth noting that no proper DNS server will see host names listed in `/etc/hosts`.) First, set up your choice of DNS server software in a "recursive resolver" configuration. [For example, with BIND](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-allow-recursion), you'll likely want to add something like `allow-recursion { 192.168.1.0/24; };` to the `options {}` block of your `named.conf`. Take care to not enable recursion for hosts that should not be allowed to use your DNS resolver for recursive queries. Second, choose a zone in which to group your local hosts, and add that. If you don't know what zone name to choose, I strongly recommend `home.arpa` ([RFC 8375](https://tools.ietf.org/html/rfc8375)). Again, with BIND as an example, add to `named.conf` *outside* of the `options {}` block a [`zone`](https://bind9.readthedocs.io/en/latest/reference.html#namedconf-statement-zone) block: zone "home.arpa" { type master; allow-transfer { none; }; file "home.arpa.db"; } Then create a `home.arpa.db` file which lists the hosts in question. The simplest incarnation of this can be something similar to: phone A 192.168.1.99 desktop A 192.168.1.33 printer A 192.168.1.44 laptop A 192.168.1.55 ; ... and so on ... Once you have the DNS zone set up, perform whatever magic is required to make your DNS server software (re)load it. Again BIND as an example, this might be `rndc reload`. Check your system logs to ensure that no errors are reported. You can then experiment a little with `dig` to check that things are working properly (`+norec` means "no recursion"; `+short` causes printing only of the relevant portion of the response, in this case an IPv4 address since we ask for `A` records): $ dig @192.168.1.123 phone.home.arpa a +short +norec 192.168.1.99 $ dig @192.168.1.123 linux.codidact.com a +short ... $ This can be expanded upon to allow for example dynamic updates, but if you are contemplating using `/etc/hosts`, the above will get you much the same results.