While managing a Domain Name Service (DNS) hierarchy can be a black art, it is possible to set up a Mini-DNS server on the FreeBSD system that also acts as your gateway to your ISP.
Building on the files in /etc/namedb when the FreeBSD system was installed it's possible to create a name server that is both authoritative for the example network shown here as well as a front-door to the Internet DNS architecture.
In this minimal DNS configuration, only three files are necessary:
The /etc/namedb/named.root file is automatically installed as part of the FreeBSD base installation; the other two files must be created manually.
The /etc/namedb/named.boot file controls the startup settings of the DNS server. Esentially, it tells the Name Server:
Where to find configuration files,
What "domain names" it's responsible for, and
Where to find other DNS servers.
Using the 'ee' editor, create a /etc/namedb/named.boot with the following contents:
; boot file for mini-name server directory /etc/namedb ; type domain source host/file backup file cache . named.root primary my.domain. mydomain.db
Lines that begin with a semi-colon are comments. The significant lines in this file are:
directory /etc/namedb
Tells the Name Server where to find the configuration files referenced in the remaining sections of the '/etc/namedb/named.boot' file.
cache . named.root
Tells the Name Server that the list of "Top-Level" DNS servers for the Internet can be found in a file called 'named.root'. (This file is included in the base installation and its contents are not described in this document.)
primary my.domain. mydomain.db
Tells the Name Server that it will be "authoritative" for a DNS domain called "my.domain" and that a list of names and IP addresses for the systems in "my.domain" (the local network) can be found in a file named 'mydomain.db'.
Once the /etc/namedb/named.boot file has been created and saved, proceed to the next section to create the /etc/namedb/mydomain.db file.
The /etc/namedb/mydomain.db file lists the names and IP addresses of every system in the Local Area Network.
For a detailed description of the statements used in this file, refer to the named manpage.
The /etc/namedb/mydomain.db file for our minimal DNS server has the following contents:
@ IN SOA my.domain. root.my.domain. ( 961230 ; Serial 3600 ; Refresh 300 ; Retry 3600000 ; Expire 3600 ) ; Minimum IN NS curly.my.domain. curly.my.domain. IN A 192.168.1.1 # The FreeBSD box larry.my.domain. IN A 192.168.1.2 # The Win'95 box moe.my.domain. IN A 192.168.1.3 # The WfW box shemp.my.domain. IN A 192.168.1.4 # The Windows NT box $ORIGIN 1.168.192.IN-ADDR.ARPA IN NS curly.my.domain. 1 IN PTR curly.my.domain. 2 IN PTR larry.my.domain. 3 IN PTR moe.my.domain. 4 IN PTR shemp.my.domain. $ORIGIN 0.0.127.IN-ADDR.ARPA IN NS curly.my.domain. 1 IN PTR localhost.my.domain.
In simple terms, this file declares that the local DNS server is:
The Start of Authority for ("SOA") for a domain called 'my.domain',
The Name Server ("NS") for 'my.domain',
Responsible for the reverse-mapping for all IP addresses that start with '192.168.1.' and '127.0.0.' ("$ORIGIN ...")
To add workstation entries to this file you'll need to add two lines for each system; one in the top section where the name(s) are mapped into Internet Addresses ("IN A"), and another line that maps the addresses back into names in the $ORIGIN 1.168.192.IN-ADDR.ARPA section.
By default the DNS server ('/usr/sbin/named') is not started when the system boots. You can modify this behavior by changing a single line in '/etc/rc.conf' as follows:
Using the 'ee' editor, load /etc/rc.conf. Scroll down approximately 40 lines until you come to the section that says:
--- named_enable="NO" # Run named, the DNS server (or NO). named_flags="-b /etc/namedb/named.boot" # Flags to named (if enabled). ---
--- named_enable="YES" # Run named, the DNS server (or NO). named_flags="-b /etc/namedb/named.boot" # Flags to named (if enabled). ---
Alternatively, start the Name Server daemon by entering the following command:
Whenever you modify any of the files in /etc/namedb you'll need to kick-start the Name Server process to make it pick up the modifications. This is performed with the following system command:
For questions about FreeBSD, e-mail
<[email protected]>.
For questions about this documentation, e-mail <[email protected]>.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |