Re: /etc/hosts question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/16/23 04:09, Tim via users wrote:

In /etc/named.conf you'd specify a zone file for the records.  I'm
showing an example from something else on my BIND server:

Good advice, you can just create a zone in your named.conf.
Then in that zone you have two options:

1. just declare that forward should be done through specific DNS servers

For example:

zone "bravesoftware.com" IN {
        type forward;
        forward only;
        forwarders {8.8.8.8; 8.8.4.4; };
};

or

2. define the zone yourself, like in the "testbed.lan.zone" example below.

What many people ignore is that you are not forced to describe an
entire zone; since DNS is a hierarchy, there is no difference between
a zone and a host. So you can override a single host.
For example, to point www.google.com to 101.102.103.104 you can add:

zone "www.google.com" {
        type master;
        file "named.www.google.com";
};

and then a file called "/var/named/named.www.google.com" which contains:

$TTL    86400
@       IN      SOA     ns.www.google.com. root.ns.www.google.com.  (
                        2023030101 ; Serial
                        8H         ; Refresh
                        2H         ; Retry
                        50W        ; Expire
                        1D )       ; Minimum
;
                NS      ns
        IN      NS      ns.www.google.com.
        IN      A       101.102.103.104
ns      IN      A       127.0.0.1

where, you can see, the important part is that for the zone "www.google.com"
we decide there are two entries, of which the first is (note the empty string)
"www.google.com" at 101.102.103.104, and the second is (note "ns")
"ns.www.google.com" at 127.0.0.1.

(All the "ns" parts are not important, but DNS zones are usually defined
in this way; I've never tried to trim the file further)


zone "testbed.lan" { type master; file "static/testbed.lan.zone"; };

That filepath would be /var/named/static/testbed.lan.zone on a non-
chrooted system.  And on a chrooted system, it's probably:
/var/named/chroot/static/testbed.lan.zone


And in that zone file, you need some basic data, plus the actual domain
name's IPs.

$ORIGIN .
$TTL 86400      ; 1 day
testbed.lan             IN SOA  ns.testbed.lan hostmaster.testbed.lan (
                                 42         ; serial
                                 300        ; refresh (5 minutes)
                                 900        ; retry (15 minutes)
                                 3600       ; expire (1 hour)
                                 1800       ; minimum (30 minutes)
                                 )
                         NS      ns.testbed.lan.
                         A       192.168.1.1
                         MX      1 mail.testbed.lan.
$ORIGIN testbed.lan.
mail                    A       192.168.1.1
ns                      A       192.168.1.1
web                     CNAME   www
www                     A       192.168.1.1
--
   Roberto Ragusa    mail at robertoragusa.it
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux