نمایش نتایج: از شماره 1 تا 2 از مجموع 2

موضوع: Setting up a Linux DNS server

  
  1. #1
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272

    Setting up a Linux DNS server

    کد:
    http://articles.techrepublic.com.com/5100-10878_11-1052952.html

    Part 1: The Configuration


    Takeaway: So, you've decided to use Linux for your Internet services. It's a good idea, but many of the available resources that help you set up your DNS server are unnecessarily confusing. That's why Vincent Danen has written this clear two-part series.

    Using Linux for your Internet services not only provides you with stability; due to Linux’s low cost, it’s also economically sound. People are beginning to use Linux as their Internet servers for a variety of reasons. If you want to make Linux your networking solution, however, you can set up many services that will provide you with a robust and suitable server environment. Besides the basic Web hosting, FTP, and e-mail services that Linux provides, you’ll also get Domain Name System (DNS) services. In this Daily Drill Down, I’ll explain how you can configure a DNS server for your Linux system. There are many resources that will help you set up a DNS server, but some of them are difficult to follow and too confusing. So, I’ll provide clear instructions for obtaining a DNS server setup that will enhance your Internet hosting services.

    Who needs DNS servers?
    Typically, people who run their own Web sites with their own domain names have external providers manage those domains. Many of these external providers allow you to change certain aspects of how you control your own domain via Web site forms and controls. However, some of these services, which are adequate for simple Web hosting servers, are lacking when it comes to handling distributed loads on your network. For example, if your primary server handles Web hosting, you may not want your FTP server to exist on the same system. Or if you run all of your servers on the same computer, you may want a backup server to assume e-mail services in case your primary server goes down. In these situations, you’ll need more flexibility than some management services give you. (You also won't have to pay someone else to manage something that you could take care of yourself.) Since the tools that you need to set up a DNS server under Linux come with almost every major distribution, there are no additional costs or required programs. You can run these services almost right out of the box.

    BIND
    Linux uses a program called BIND (Berkeley Internet Name Domain) to provide the DNS server, which is a daemon called named. This daemon handles all of the DNS queries for whichever domains you run or manage. In fact, named is a full-fledged DNS server. If you manage multiple domains, this daemon can handle all of them very easily. On most distributions, the BIND package will have been installed by default, but you should check to see if the /usr/sbin/named file exists (it’s the named executable). On Red Hat systems or other distributions that use RPM (Red Hat Package Manager) technology, you can run the following line:
    rpm -q bind

    If this package isn’t installed, you should be able to obtain it from the distribution vendor, a mirror site, or your installation CD-ROM. Once you’ve installed BIND, you’re ready to begin setting up your new DNS server. For this Daily Drill Down, I’ll install and configure BIND on a Linux Mandrake 7.0 computer for the fictional domain xyz.com.

    SOA resource records
    The first step in setting up the DNS server for xyz.com is to edit a database file for the SOA (Start of Zone Authority) resource records. The SOA resource records are the meat of the server; they provide the information that’s needed to resolve domain names to IP addresses. These files are typically stored in the /var/named directory, but you can name them anything you want. For this example, I’ll name my SOA file /var/named/xyz.com.

    The SOA resource records require a number of fields, which I’ll explain as I proceed. You can include comments in the resource file by typing a semicolon (;) before the comment. Comments will help you understand what you did and what everything means if you need to refer to them later. You should write as many comments in the file as you think you need. The resulting file will look something like the following:
    @INSOAns.xyz.com root.titan.xyz.com (
    2000031601 ; serial number
    7200 ; refresh (2hrs)
    3600 ; retry (1hr)
    151200 ; expire (1 week)
    86400 ) ; default TTL

    This is the beginning of our SOA resource file. The first line gives us a few pieces of information for this SOA record. The @ character represents the domain name for this zone. (Later, you’ll see how it gets translated.) The IN statement stands for Internet Name, and SOA tells us that we’re defining the SOA for our domain (xyz.com). The first domain name after SOA defines the primary name server for this domain (ns.xyz.com). The second field is the administrative e-mail address (root@titan.xyz.com). Notice that the e-mail address uses a period instead of the @ character in the SOA record, so make sure that you format the e-mail address correctly. After the administrative e-mail address, type an opening parenthesis to indicate the following numeric statements.

    The next lines indicate parameters for the server. The first number is the serial number. Some people use one or two digits for the serial number, but I prefer to use the date and a revision number. The above serial number translates into “03/16/2000—revision 01.” Every time you change the resource record, you need to increase the serial number by one before you restart named. That way, secondary servers will know that they have to perform a zone transfer. If you never increase this number, your changes will never take effect.

    The second number is the refresh rate in seconds. This value tells the DNS servers how often they should query the primary server to see if the records have been updated at all. The third number is the retry rate in seconds. If the secondary server tries to contact the primary DNS server to check for updates but can’t contact it, the secondary server will try again after the number of seconds that you’ve defined here has elapsed.

    The fourth number relates to secondary servers that have cached the entry. If these secondary servers can’t contact the primary server for an update, they will discard the cached value after the specified number of seconds. You should specify a value of one to two weeks. The fifth and final number tells caching servers how long they should wait before allowing an entry to expire if they can’t contact the primary DNS server. Five to seven days is a typical value for this number. Finally, you must place a closing parenthesis to end the statement.

    NS servers
    The next entries should specify the authoritative NS (Name Server) servers for your domain. Using the previous example, we would type something like this:
    NSns.xyz.com.
    NSns2.xyz.com.

    There are two authoritative name servers for the xyz.com domain: ns.xyz.com (the computer that we’re currently setting up) and ns2.xyz.com (a secondary or backup DNS server). Since both are fully qualified hostnames, they need to have periods after their names. If you were to write the above lines as ns.xyz.com and not as ns.xyz.com., the server would translate the addresses as ns.xyz.com.xyz.com. You probably don’t want that.

    MX records
    The next entry should include the MX (Mail Exchanger) records. This entry tells the outside world that the defined machine will be in charge of receiving mail from external networks. If you have two computers (one for a primary and one for a secondary/backup mail server), you might issue the following lines:
    MX10 mail.xyz.com.
    MX50 ns2.xyz.com.

    These lines tell external networks to try to deliver mail to the mail.xyz.com machine first. If the first machine can’t be reached, then external networks will deliver mail to ns2.xyz.com. The number in the second column is a priority number. You can use any number as long as you adhere to one rule: Lower numbers have a higher priority. Since mail.xyz.com has a priority level of 10, it has a higher priority than ns2.xyz.com, which has a priority level of 50. Thus, all external mail servers will attempt to deliver mail to mail.xyz.com first.

    A records
    The next section deals with A (Address Record) records. Address records provide translations from hostnames to IP addresses. You should have A records for all of the machines for which you want to have a recognized hostname. If you have four computers in your network, you would run the following lines:
    nsA192.168.1.1
    ns2A192.168.1.2
    workA192.168.1.3
    develA192.168.1.4

    These lines tell the DNS server that ns.xyz.com is mapped to the IP address of 192.168.1.1 but that devel.xyz.com is mapped to the IP address of 192.168.1.4. Since there’s no period after the hostname, the DNS server assumes the same domain of the current SOA record (the xyz.com SOA).

    CNAME records
    The next section should contain any Canonical Name (CNAME) records (also known as hostname aliases) that you want to define. Using CNAME aliases is quite common and very helpful in giving common names to servers. For example, suppose that your mail server's real hostname is work because you complete other work on it. You could give it a CNAME of mail so that you could reach it through both work.xyz.com and mail.xyz.com. For the CNAME to work, you must have defined an Address (A) or Mail Exchange (MX) record already:
    MailCNAMEwork
    wwwCNAMEwork
    ftpCNAMEwork
    mail2CNAMEdevel

    The above lines will map mail.xyz.com, XYZ Consulting, and ftp.xyz.com to the work.xyz.com computer. Also, you must define an alias of mail2.xyz.com, which points to the devel.xyz.com computer.

    TXT and RP records
    Finally, you can include some text information in your SOA record by using the TXT and Responsible Person (RP) record types. They are useful for providing contact information in your DNS records that others can query. TXT records are free-form records that can place any information that you want to make available to others. TXT records must be tied to a particular hostname, however, so order is important. Below, I’ll illustrate what your /var/named/xyz.com file should look like, and you’ll see how you should place your TXT records:
    TXT"Contact: Jim Smith"
    TXT"Great Guru of Linux"

    The RP records are also informational, but there’s a particular syntax that you must follow when you use them:
    RPadmin.xyz.comxyz.com.

    The first field in the RP record is the e-mail address of the person in charge of this domain. Notice that the @ symbol has been replace by a period. (The actual e-mail address is admin@xyz.com.) The last column specifies a TXT record, which provides more information. In this case, it’s the TXT record for xyz.com.

    The finished product
    Now, we’ve defined all of the important parts of our primary SOA record in the /var/named/xyz.com file. The finished product will look something like this:
    ; Forward resolution for xyz.com
    ;
    @INSOAns.xyz.com root.titan.xyz.com (
    2000031601 ; serial number
    7200 ; refresh (2hrs)
    3600 ; retry (1hr)
    151200 ; expire (1 week)
    86400 ) ; default TTL
    ; define our name servers:
    NSns.xyz.com.
    NSns2.xyz.com.
    ; define our mail severs:
    MX10 mail.xyz.com.
    MX50 ns2.xyz.com.
    ; define the contact information for this domain:
    TXT"Contact: Jim Smith"
    TXT"Great Guru of Linux"
    RPadmin.xyz.comxyz.com.
    ; define addresses and aliases:
    nsA192.168.1.1
    ns2A192.168.1.2
    ;
    workA192.168.1.3
    mailCNAMEwork
    wwwCNAMEwork
    ftpCNAMEwork
    ;
    develA192.168.1.4
    MX10 mail2.xyz.com.
    mail2CNAMEdevel

    With the exception of another MX record, all of the above lines are the same as the ones I’ve already listed. Since order is important, we can perform several interesting tasks, such as defining different mail servers for different machines. In the above example, all machines use mail.xyz.com or ns.xyz.com for their mail servers—except for devel.xyz.com, which uses its own mail server on the same computer. Then, we defined the Address record for devel.xyz.com and gave it a specific MX record (mail2.xyz.com), which is a CNAME alias for devel.xyz.com. There are a number of ways in which you can perform tasks with your DNS server and the records you’re setting up. The above example is pretty simplistic, but other examples can become much more complicated and powerful.

    Reverse resolution database
    Now that you’ve defined your primary SOA, you must provide a reverse resolution database to match it. Place the second database in a file called /var/named/192.168.1. It follows pretty much the same syntax as the first database, but you don't define its A, MX, CNAME, TXT, or RP records.
    ; Reverse resolution for xyz.com
    ;
    @INSOAns.xyz.com root.titan.xyz.com (
    2000031601 ; serial number
    7200 ; refresh (2hrs)
    3600 ; retry (1hr)
    151200 ; expire (1 week)
    86400 ) ; default TTL
    ; define our name servers:
    NSns.xyz.com.
    NSns2.xyz.com.
    1PTRns
    2PTRns2
    3PTRwork
    4PTRdevel

    The SOA record and the NS records are exactly the same. The new record type that we see here is the Pointer (PTR) record. The Pointer record is also known as the reverse resolution record, and it tells named how to turn an IP address into a hostname. If you look closely, you’ll see that the PTR record starts with a single digit, which happens to be the last octet of the IP address for the defined hostnames. What we’re telling named is that 192.168.1.1 points to the hostname ns, which in turn resolves to ns.xyz.com—and so on. You’ll see how named knows to complete the IP address in a moment.

    Next, you have to tell named that it needs to read these databases. So, you must edit the /etc/named.boot file. Your named.boot file should look like this:
    directory/var/named
    cache. named.ca
    primaryxyz.comxyz.com
    primary1.168.192.in-addr.arpa192.168.1

    These lines tell named to use the /var/named directory (which is where we saved our databases). They also tell named to cache the DNS entries and speed things up a bit. Finally, we define two primary zone records: one for the forward resolution of xyz.com (our /var/named/xyz.com file) and one for the reverse resolution of our IP addresses (our /var/named/192.168.1 file). Remember, in our SOA records, we used the @ symbol to represent our domain name. This is where the SOA record obtains the domain name. For example, you can define your databases in one of two ways. First, you can type:
    @INSOAns.xyz.com root.titan.xyz.com (

    Or you can define them like this:
    xyz.com.INSOAns.xyz.com root.titan.xyz.com (

    Using substitution with the @ symbol is easier because you’ll only need to change your /etc/named.boot file if you want to change the domain name. Now, you have one last file to configure: the /etc/named.conf file. It looks like this:
    options {
    directory "/var/named";
    };
    zone "." {
    type hint;
    file "named.ca";
    };
    zone "xyz.com"{
    type master;
    file "xyz.com";
    };
    zone "1.168.192.in-addr.arpa"{
    type master;
    file "192.168.1";
    };

    This file is pretty straightforward, and it almost duplicates what we put in the named.boot file. The first line specifies the options where you define the base directory for named (which is /var/named). The zone entries are for each domain and reverse resolution record that you define. Notice that xyz.com points to the /var/named/xyz.com file, while the reverse resolution (which is recognized by 1.168.192.in-addr.arpa) points to the /var/named/192.168.1 file. Also notice that our cache file (which is specified by the period in the first zone statement) is the /var/named/named.ca file. This file came with the BIND program that you installed. Basically, it’s a file that contains the IP addresses of the root DNS servers; it allows named to prime the cache.

    For both domain zones, you can define the authoritative system by indicating that the machine is of the “master type.” If you were setting up a secondary DNS server, you would indicate that the machine was of the “slave type.” Here’s an example of a secondary DNS server zone statement:
    zone "xyz.com"{
    type slave;
    file "xyz.com";
    masters { 192.168.1.1; };
    };

    These lines tell named that this machine is a secondary (or slave) DNS server. They also point to the primary (or master) DNS server (192.168.1.1).

    Starting the service
    Now that you know how to configure the DNS server, you're probably wondering how to start it. On Linux Mandrake and Red Hat systems, the appropriate command to start the named daemon would be:
    /etc/rc.d/init.d/named start

    You could use this chkconfig utility and force the DNS server to start at boot:
    chkconfig --level 2345 named on

    To start the server in the background on all other systems, simply run named without command line arguments. If you want to look at the man pages and see what other command line options can be used, run man named.

    Conclusion
    Setting up a DNS server can become time-consuming and confusing. However, I trust that I’ve made the process a little easier to understand. If you want more information on BIND, take a look at Internet Software Consortium. You should check out this DNS HOWTO for more information, too.
    Vincent Danen, a native Canadian in Edmonton, Alberta, has been computing since the age of 10, and he’s been using Linux for nearly two years. Vincent is a firm believer in the philosophy behind the Linux "revolution,” and heattempts to contribute to the Linux causein as many ways as possible—from his FreezerBurn Web site to building and submitting custom RPMs for the Linux Mandrake project. Vincent also has obtained his Linux Administrator certification from Brainbench .He hopes to tackle the RHCE once it can be taken in Canada.
    The authors and editors have taken care in preparation of the content contained herein, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes




    موضوعات مشابه:

  2. #2
    نام حقيقي: 1234

    مدیر بازنشسته
    تاریخ عضویت
    Jul 2009
    محل سکونت
    5678
    نوشته
    5,634
    سپاسگزاری شده
    2513
    سپاسگزاری کرده
    272
    کد:
    http://articles.techrepublic.com.com/5100-10878_11-1052935.html?tag=rbxccnbtr1
    Part 2: Ongoing Maintenance


    Takeaway: See how to set up a secondary DNS server and learn how to make changes to records and keep DNS servers up to date.

    In "Setting up a DNS server under Linux, part 1: The configuration," I discussed the initial setup and configuration of a primary DNS server. This week, I’ll explain how to configure a secondary DNS server and how to maintain and apply changes to your DNS servers. I’ll also show you some other interesting and useful things that you can do with your DNS server.

    Configuring a secondary DNS server
    You must set up a secondary DNS server (also known as a slave server). Let’s assume that you’ve already set up your primary DNS server. Call it ns.mydomain.com and give it an IP address of 192.168.1.1. Now, you’ll need to set up a secondary DNS server, which will be called ns2.mydomain.com and which will have an IP address of 192.168.1.2. Of course, you’ll also need to configure your /etc/named.boot file, which is similar to the file that has the same name on your primary server. For example, your primary server’s /etc/named.boot file may look like this:
    directory/var/named
    cache.named.ca
    primarymydomain.commydomain.com
    primary1.168.192.in-addr.arpa192.168.1

    But the /etc/named.boot file on the secondary server should look like:
    directory/var/named
    cache.named.ca
    secondarymydomain.com192.168.1.1 mydomain.com
    secondary1.168.192.in-addr.arpa192.168.1.1 192.168.1

    The differences between the two servers aren't significant. In the first column of the secondary server, you have to tell named that it’s “secondary” (as opposed to “primary”). In the third column, don’t type the database filename; instead, type the IP address of the primary server (and ns.mydomain.com’s IP address is 192.168.1.1). In the fourth column, type the database filename for that domain.

    Please note that you don’t create the database on the secondary DNS server. Upon startup and as DNS refreshes (as determined by the primary DNS server of any given domain), named probes the primary DNS server for changes to any domain databases for which it acts as a secondary server. Thus, named actually creates the database files as they are required. The only other file for your secondary DNS server that you need to worry about is the /etc/named.conf file. It looks something like this:
    options {
    directory "/var/named";
    };
    zone "." {
    type hint;
    file "named.ca";
    };
    zone "mydomain.com"{
    type slave;
    file "mydomain.com";
    masters { 192.168.1.1; };
    };
    zone "1.168.192.in-addr.arpa"{
    type slave;
    file "192.168.1";
    masters { 192.168.1.1; };
    };

    This file looks very similar to the /etc/named.conf file that exists on your primary DNS server. The only difference is that the type keyword is "slave" instead of "master,” which indicates that it’s a secondary DNS server. In parentheses, the new keyword (masters) includes the IP address of the primary (or master) DNS server.

    Maintaining your secondary DNS server is as simple as setting it up. The primary DNS server takes care of any changes that are made to MX records or other DNS information for a particular domain. Based on a time interval that was predetermined by the domain records, the secondary DNS server merely looks for updates. The only times when you’ll need to edit your /etc/named.boot and /etc/named.conf files are when you add or remove a domain. Otherwise, your secondary DNS server will take care of itself.

    Delegating authority to subdomains
    Some domains are quite large, and they often split up into logical subdomains for differing company divisions or groups. For example, a university that owns the domain myuniv.edu may want to give the physics department a subdomain of phys.myuniv.edu. However, if the physics department is large and has many computers, it will have to assign a lot of DNS entries. Instead of updating the primary DNS authority for myuniv.edu, the university could let phys.myuniv.edu have its own primary DNS server. That way, the physics department could make changes without disturbing the administrator of the domain’s primary DNS server. Now, let’s assume that the primary DNS for myuniv.edu is ns.myuniv.edu and the primary DNS for phys.myuniv.edu is h2o.phys.myuniv.edu. The database file for myuniv.edu might look like this:
    @INSOA...
    INA10.1.1.25
    INMXmail.myuniv.edu.
    INMXns.myuniv.edu.

    h2o.physINA10.1.2.80

    physINNSh2o.phys.myuniv.edu.
    INNSns.myuniv.edu.

    In this example, we gave h2o (the primary DNS for phys.myuniv.edu) an IP address of 10.1.2.80 as a precaution. If the folks in the physics department accidentally destroy their DNS data, their primary DNS server will still exist in ns.myuniv.edu's domain records. Since the h2o machine belongs to the phys subdomain, you should place h2o.phys in the first column (and not h2o). Doing so translates into h2o.phys.myuniv.edu—not just h2o.myuniv.edu (which is incorrect). The second NS line exists because you’ll want ns.myuniv.edu (the primary DNS server for the university) to act as a secondary DNS server for the new subdomain.

    If you’re delegating authority for PTR records, the same rules apply. Your reverse resolution file on the primary server might look like this:
    @INSOA...
    INNSns.myuniv.edu.
    25.1INPTRmail.myuniv.edu
    ...
    2INNSh2o.phys.myuniv.edu

    In the database, you’ll see two places for IP addresses. The first PTR record will resolve to 10.1.1.25, which points to mail.myuniv.edu. The final NS record in the database tells people who query 10.1.2.0-10.1.2.255 to send their queries to h2o.phys.myuniv.edu for the reverse resolution. The reverse resolution file on the primary DNS server should be named /var/named/10.1.db. That way, it can handle the 1.10.in-addr.arpa domain. Of course, this method only works if you delegate an entire byte boundary to the subdomain. If you just want to delegate 10.1.2.1-10.1.2.50, you have a lot of typing ahead of you; you’ll need to enter the following lines into your reverse resolutions file:
    @INSOA...
    INNSns.myuniv.edu.
    25.1INPTRmail.myuniv.edu
    ...
    1.2INCNAME1.1-50.1.10.in-addr.arpa
    2.2INCNAME2.1-50.1.10.in-addr.arpa
    ...
    49.2INCNAME49.1-50.1.10.in-addr.arpa
    50.2INCNAME50.1-50.1.10.in-addr.arpa
    1-50INNSh2o.phys.myuniv.edu

    You have to type 50 different CNAME records, all of which point to the final NS record. Basically, you’re telling the requesting DNS server not to look for 1.2.1.10.in-addr.arpa (the reverse resolution for 10.1.2.1); instead, it should look for 1.1-50.1.10.in-addr.arpa, which points to the DNS server h2o.phys.myuniv.edu. This DNS server will answer the query.

    Frankly, however, delegating reverse resolution to a subdomain that doesn’t occur on a byte boundary is more of a pain than it’s worth. It would be easier to let the primary server handle reverse resolutions instead of delegating the job to the subdomain. Since reverse resolution is extremely important, you can’t just forget about it. But there are easier ways to handle subdomain delegation than to delegate both forward and reverse resolutions to the subdomain. You could delegate forward resolutions to the subdomain and keep reverse resolutions on the primary domain.

    Managing multiple domains
    More often than not, a DNS server will have to manage more than one domain. You can even make a DNS server act as the primary server for some domains and as a secondary server for others—all with the same setup. It isn't very hard to do, but it involves several steps that you need to follow. First, you must edit your /etc/named.boot file so that you can manage the xyz.com domain, which we examined in the first part of our series, and the mydomain.com domain. With the following code, this machine will also become the secondary DNS server for otherdomain.com:
    directory/var/named
    cache.named.ca
    primaryxyz.comxyz.com.db
    primarymydomain.commydomain.com.db
    secondaryotherdomain.com192.168.1.28 otherdomain.com.db
    primary1.168.192.in-addr.arpa192.168.1.db

    Your DNS server will be the primary server for xyz.com and mydomain.com, and it will be the secondary server for otherdomain.com. You can obtain the DNS records from the primary DNS server for otherdomain.com at 192.168.1.28. Next, edit the /etc/named.conf file so that it will provide the same information:
    options {
    directory "/var/named";
    };
    zone "." {
    type hint;
    file "named.ca";
    };
    zone "xyz.com"{
    type master;
    file "xyz.com.db";
    };
    zone "mydomain.com"{
    type master;
    file "mydomain.com.db";
    };
    zone "otherdomain.com"{
    type slave;
    file "otherdomain.com.db";
    masters { 192.168.1.28; };
    };
    zone "1.168.192.in-addr.arpa"{
    type master;
    file "192.168.1.db";
    };

    Configure the database files as you normally do. For example, edit the resource records in /var/named/xyz.com.db, /var/named/mydomain.com.db, and 192.168.1.db. Remember, named creates the /var/named/otherdomain.com.db file when it refreshes the zone information for the otherdomain.com domain.

    Now, you're going to have to decide which is your primary domain. Let's assume that mydomain.com is the primary domain for your system and that xyz.com is a domain that you’re hosting (but that you don’t necessarily own). This distinction is important when you’re setting up your reverse resolution records (or the 192.168.1.db file). When you perform reverse resolution, you can point to only one machine name per IP address.

    For example, let’s assume that mydomain.com has three machines, and each machine has its own separate IP address that’s reachable from the Internet. Your primary machine is called web.mydomain.com because it’s your Web server. It also acts as your primary DNS server. The second machine is called mail.mydomain.com, and it acts as your SMTP and POP3 server. The third machine, which is called backup.mydomain.com, is your secondary DNS server. Setting up your network this way will distribute the load across multiple computers; no single computer will become completely saturated with IP traffic.

    If you’re hosting xyz.com, give it the same information. Define web.xyz.com, mail.xyz.com, and backup.xyz.com and define any appropriate CNAME records along the way. Now, you have two fully qualified domain names per machine, for your Web server can be reached by web.mydomain.com and web.xyz.com. Similarly, the other two machines can be reached by two different (but fully qualified) domain names. You can’t place both of these domains in your reverse resolution database, so you use your primary domain instead (mydomain.com). Your reverse resolution file might look like this:
    NSweb.mydomain.com.
    NSbackup.mydomain.com.
    1PTRweb.mydomain.com.
    2PTRmail.mydomain.com.
    3PTRbackup.mydomain.com.

    If you follow these steps, you shouldn’t have any problems serving multiple domains from one machine. Basically, all you really need is one primary domain for your network. Usually, when you define the hostname for your computer, you have only one hostname and one domain name. This domain name will become your primary domain because it’s the one that’s used across your network.

    Forwarding DNS requests
    Forwarding DNS requests to another DNS server is a simple way of lessening the load on your DNS server. If the local server receives any queries that it can’t resolve from its own local cache, it will forward hostname lookup requests to a specific list of servers. This method builds a rich cache on the selected server and keeps the load down on secondary servers. If possible, this selected server should exist on your local network. That way, you’ll prevent your secondary servers from reaching out to the Internet to resolve hostname lookups. Only one server on your local network will look up hostnames across the Internet, which can become very helpful if you’re paying for Internet usage. Here’s an example of a /etc/named.conf file using the forwarders option:
    options {
    directory "/var/named";
    forwarders first;
    forwarders { 192.168.1.1; 192.168.1.2; };
    };

    These lines tell the local server to try the forwarders before it tries to get an answer from any other external server (such as the root servers that InterNIC runs). The forwarders first; option is somewhat redundant because it tells the local server to try the forwarders before trying anything else, which is the default setup. An alternative option is the forwarders only; option, which tells the local server to talk to forwarders only. With the forwarders only; option, any queries not resolved by the forwarders will remain unresolved because the local server is explicitly told not to try any external servers. The forwarders option contains a list of DNS servers to which all queries will be forwarded. (In the above lines, 192.168.1.1 would be consulted first; then, 192.168.1.2 would be consulted.)

    Final tips
    Now, I'm going to give you two tips that will save you a lot of headaches. If this is the first DNS server that you’ve ever set up, you’ll want to pay close attention to these tips. First, due to various RFCs that relate to domain name services, you must keep in mind that NS and MX records can’t point to CNAME records. These record types must point to an explicitly defined A record. If not, named will remind you by writing an error to the syslog. Although named will run with NS and MX records pointing to CNAMEs, it isn’t proper, and this method may cause problems. Pointing to a name server called bunny.xyz.com instead of ns.xyz.com may not be as cosmetic, but it’s proper. Since this difference is invisible to everyone except other DNS servers, it doesn't really matter. You can define a CNAME of ns.xyz.com to point to bunny.xyz.com. If you’re worried about cosmetics, you can tell your users to use ns.xyz.com as the DNS server for normal hostname resolving.

    Second, if you want to set up primary and secondary DNS servers, make sure that they exist on separate machines. Remember, named doesn't like it very much if you tell it to act as both primary and secondary DNS for any given zone or domain. It will write an error to the syslog if it encounters this configuration.

    Conclusion
    Setting up a DNS server can remain a simple and straightforward job, or it can become extremely complex—based on your needs. I trust that I've approached the configuration and installation of BIND and the DNS server system in a way that will help you get the most out of any DNS server that you set up. Another excellent source of information on DNS is the DNS Resources Directory. This source will help you obtain further advanced configuration, if you require it.
    Vincent Danen, a native Canadian in Edmonton, Alberta, has been computing since the age of 10, and he’s been using Linux for nearly two years. Prior to that, he used OS/2 exclusively for approximately four years. Vincent is a firm believer in the philosophy behind the Linux "revolution,” and heattempts to contribute to the Linux causein as many ways as possible—from his Freezer Burn Web siteto building and submitting custom RPMs for the Linux Mandrake project. Vincent also has obtained his Linux Administrator certification from Brainbench.He hopes to tackle the RHCE once it can be taken in Canada




کلمات کلیدی در جستجوها:

هیچ کلمه ای ثبت نشده است.

برچسب برای این موضوع

مجوز های ارسال و ویرایش

  • شما نمی توانید موضوع جدید ارسال کنید
  • شما نمی توانید به پست ها پاسخ دهید
  • شما نمی توانید فایل پیوست ضمیمه کنید
  • شما نمی توانید پست های خود را ویرایش کنید
  •