From the computer of: qmchenry
(339 recipes)
Created: Jan 04, 2004
The zone file needs to be created within the DNS server's working directory. There is no requirement for filenames with zone file, but a reasonable standard is db.domain.name, the name of the domain preceded by db.
The basic format of the zone file is a time to live (TTL) field followed by the start of authority (SOA) records. The TTL instructs non-authoritative DNS servers how long to cache records retrieved from the zone file. The longer this period, the longer it will take to propagate changes to the zone files. The shorter the TTL, the harder your DNS servers will work beacuse non-authoritative servers will have to ask it the same question more frequently. Values from a few hours to a day are reasonable.
An integer TTL value is interpreted as seconds, although for those of us who are not walking calculators, adding m at the end means minutes, h hours, d days, and w weeks. A day would be represented by any of the following lines:
The SOA section is an intimidating chunk of code for the uninitiated, but each field in the SOA has a meaningful purpose and taken a piece at a time, it is simple. The SOA starts with the zone's primary domain name (we'll use tech-recipes.com in this recipe), the class of the zone (IN), SOA, and the following seven fields in order:
MNAME The master dns server for the zone (for example ns1.tech-recipes.com.).
RNAME An email address for someone responsible for the domain (with the @ replaced with a .) such as nospam.tech-recipes.com.
Serial number This value is perhaps the greatest source of DNS-related head scratching. To make things fast and efficient, BIND processes zone files into another format. When BIND loads a zone file at startup, it checks the serial number and only processes the zone file if the serial number is bigger than its previously processed version. So, if you change the zone file but not the serial number, BIND will ignore the changes.
A common format for the serial number contains the date and a unique serial number (YYYYMMDDNN) such as 2004010402 for the second revision (02) of the file on January 4, 2004. This allows for 100 changes to the file in a day. If more changes are required, I recommend going home for a good night's sleep.
Refresh Secondary or slave servers can be configured to poll the master server with this period to check if the serial number has changed and therefore if it needs to update the zone file.
Retry If the master DNS server for the zone fails to answer a slave server's request for an update, the slave server will ask this often. Typically an hour or less.
Expire In the event of a failure of the master DNS server, a slave server will continue to use its existing data for this period of time. After the expire time has passed, the data are considered stale and will not be used at which time the domain will no loger resolve. This value should be long enough to allow master server outages to be corrected, on the order of weeks.
Negative caching TTL Negative answers (such as when a requested record does not exist) can be cached on non-authoritative servers as well. This field acts like the overall TTL but specifically for negative answers. Small values are appropriate (15m to 2h).
The fields can be placed within parentheses if they extend over more than one line. Putting this all together, the following is the zone file (minus any resource records) for the domain tech-recipes.com:
The biggest gotcha with DNS zone files is the proper use of fully qualified domain name syntax. This means that a full domain name will end with a period (tech-recipes.com.) -- without this period, BIND will assume that you are using shorthand and will add the zone's default domain name to the end of the name (so tech-recipes.com would really mean tech-recipes.com.tech-recipes.com.).
Subscribe to the Tech-Recipes Newsletter
You can get tips like this delivered in your email every week!
We will never, ever sell your email address or spam you.
1 Recipe comments: View comments
DNS/BIND: Create a basic zone file by Anonymous
Related recipes:
DNS/BIND resource record: Address (A) record
DNS/BIND resource record: PTR reverse lookup record
DNS/BIND resource record: using $GENERATE to make many records
DNS/BIND: set TTL for individual resource records
DNS/BIND resource record: CNAME, canonical names, host aliases
DNS/BIND troubleshooting: request a domain's SOA using dig
DNS/BIND resource record: routing mail with MX records
Search for mail exchanger (MX) records using dig
Sponsored links
Login
Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.Search
Tech Recipes
· Home
· Mac OS X
· Solaris
· Windows
· Programming
· UNIX
· Cisco
· MySQL
· Google
· Instant messaging
· Add recipes
· Leave feedback
· Recommend us
· RSS Syndication
Hot recipes
Make XP look like Windows Vista / Longhorn for free!
XP: Small, Free Way to Use and Mount Images (ISO files) Without Burning Them
SMS through E-Mail: Cingular, Nextel, Sprint, T-Mobile, Verizon, Virgin Mobile
Vista: Should I Install 64-bit or 32-bit Version? (x64 vs x86)
MySpace Hack: View Pictures and Comments on a Private Profile
How Do I Use or Open Bin, Cue, or ISO Files?
Hacks to Beat Rapidshare Download Limits and Waiting Time
MySpace: Hack to Download Any Song on MySpace
Who's Online
There are currently, 2094 guest(s) and 2 member(s) that are online.
You are Anonymous user. You can register for free by clicking here
Information
Wish to advertise with us?
All logos and trademarks in this site are property of their respective owner. The comments and forum posts are property of their posters, all the rest © 2003-2007 by QD Ideas, LLC.
Users of this site are legally bound by the Terms and conditions and Disclaimer. Do not use this web site if you do not agree with these policies.
The members, admins, and authors of this website respect your privacy.
Page Generation: 0.54 Seconds
Thu Aug 21 17:03:01 2008