(This page has no text content)
(This page has no text content)
(This page has no text content)
DNS and BIND on IPv6 Cricket Liu Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
DNS and BIND on IPv6 by Cricket Liu Copyright © 2011 Cricket Liu. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com. Editor: Mike Loukides Production Editor: Holly Bauer Proofreader: Holly Bauer Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano Printing History: May 2011: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. The image of crickets and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-30519-2 [LSI] 1304702366
Table of Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii 1. DNS and IPv6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Background 1 IPv6 and DNS 2 The ABCs of IPv6 Addresses 2 IPv6 Forward and Reverse Mapping 4 AAAA and ip6.arpa 5 Adding AAAA Records to Forward-Mapping Zones 5 IPv6 Reverse-Mapping Zones 6 Delegation and Reverse-Mapping Zones 7 Built-In Empty Reverse-Mapping Zones 8 2. BIND on IPv6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Listening for Queries 11 Sending Queries 12 More on Query Port Randomization 12 Forcing the Use of a Particular Protocol 13 IPv6 Masters and Slaves 13 Other IPv6 Zone Transfer Controls 14 IPv6 Networks and Addresses in ACLs 15 Registering IPv6 Name Servers 16 Delegating to IPv6 Name Servers 16 Server Statements for IPv6 Name Servers 17 Special Considerations 17 Handling “Monolingual” Name Servers 17 Handling Broken Resolvers 18 rndc and IPv6 19 3. Resolver Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Mac OS X 21 v
Windows 22 Dynamic Resolver Configuration 24 Resolver Configuration Using DHCPv6 25 Resolver Configuration Using Router Advertisements 25 4. DNS64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Authoritative Name Servers and DNS64 30 Interaction Between DNS64 and DNSSEC 30 DNS64 and Reverse Mapping 31 5. Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 nslookup 33 dig 35 vi | Table of Contents
Preface I’m sorry for writing this ebook. Well, that’s not quite accurate. What I mean is, I’m sorry I didn’t have time to update DNS and BIND to include all this new IPv6 material. DNS and BIND deserves a sixth edition, but I’m afraid my schedule is so hectic right now that I just don’t have time to write it. Heck, I’m on a flight from Boston to Tampa as I write this. (Long flights are great for writing prefaces, not so great for writing books about Internet technologies. Though in-flight Internet access does help.) This book is essentially all the material related to IPv6 that I would have included in the sixth edition of DNS and BIND (and will, once I get to it). It covers how DNS was extended to accommodate IPv6 addresses, both for forward-mapping and reverse- mapping. It describes how to configure a BIND name server to run on an IPv6 network and how to troubleshoot problems with IPv6 forward- and reverse-mapping. It even covers DNS64, a DNS-based transition technology that, together with a companion technology called NAT64, can help islands of IPv6-only speaking hosts communicate with IPv4 resources. Audience I wrote this book for DNS administrators who are rolling out IPv6 on their networks and who need to understand how to support IPv6 on those networks with DNS. This ebook covers the underlying theory, including the structure and representation of IPv6 addresses; the A, M, and O flags in Router Advertisements and what they mean to DNS; as well as the nuts and bolts, including the syntax of AAAA records and PTR records in the ip6.arpa reverse-mapping zone and the syntax and semantics of configuring a BIND name server. Assumptions This Book Makes This book assumes that you understand basic DNS theory and BIND configuration. It doesn’t explain what a resource record is or how to edit a zone data file, or remind you vii
that you need to increment the serial number of the zone’s SOA record before reloading it (other than just now)—for that, I highly recommend DNS and BIND. But that shouldn’t surprise you. The book doesn’t assume that you know anything in particular about IPv6, though. Contents of This Book This book is organized into five chapters as follows: Chapter 1, DNS and IPv6 This chapter explains the motivation behind the move to IPv6 and describes the structure and representation of IPv6 addresses. It also introduces the syntaxes of AAAA records and PTR records in the ip6.arpa IPv6 reverse-mapping zone and explains how to delegate subdomains of ip6.arpa zones. Chapter 2, BIND on IPv6 This chapter describes how to configure BIND name servers to run on IPv6 net- works, including how to configure IPv6 master and slave name servers, how to use IPv6 addresses and networks in ACLs, and how to register and delegate to IPv6- speaking name servers. The chapter also includes a section on special considera- tions that may arise because IPv6 connectivity is not yet pervasive. Chapter 3, Resolver Configuration This chapter shows how to configure popular stub resolvers (Linux/Unix, Mac OS X and Windows) to query IPv6-speaking name servers. It also covers dynamic configuration of resolvers using DHCPv6 and Router Advertisements. Chapter 4, DNS64 This chapter explains the DNS64 transition technology, which allows clients with IPv6-only network stacks to communicate with IPv4 servers. Chapter 5, Troubleshooting This chapter describes how to use the common nslookup and dig troubleshooting tools to look up the IPv6 addresses of a domain name or reverse-map an IPv6 address to a domain name. It also covers how to query a name server’s IPv6 address. Conventions Used in This Book The following typographical conventions are used in this book: Plain text Indicates menu titles, menu options, menu buttons, and keyboard accelerators (such as Alt and Ctrl). Italic Indicates new terms, URLs, email addresses, filenames, file extensions, pathnames, directories, and Unix utilities. viii | Preface
Constant width Indicates commands, options, switches, variables, attributes, keys, functions, types, classes, namespaces, methods, modules, properties, parameters, values, ob- jects, events, event handlers, XML tags, HTML tags, macros, the contents of files, or the output from commands. Constant width bold Shows commands or other text that should be typed literally by the user. Constant width italic Shows text that should be replaced with user-supplied values. This icon signifies a tip, suggestion, or general note. This icon indicates a warning or caution. Using Code Examples This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission. We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “DNS and BIND on IPv6 by Cricket Liu (O’Reilly). Copyright 2011 Cricket Liu, 978-1-449-30519-2.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com. Safari® Books Online Safari Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly. Preface | ix
With a subscription, you can read any page and watch any video from our library online. Read books on your cell phone and mobile devices. Access new titles before they are available for print, and get exclusive access to manuscripts in development and post feedback for the authors. Copy and paste code samples, organize your favorites, down- load chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other time-saving features. O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other pub- lishers, sign up for free at http://my.safaribooksonline.com. How to Contact Us Please address comments and questions concerning this book to the publisher: O’Reilly Media, Inc. 1005 Gravenstein Highway North Sebastopol, CA 95472 (800) 998-9938 (in the United States or Canada) (707) 829-0515 (international or local) (707) 829-0104 (fax) We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at: http://www.oreilly.com/catalog/9781449305192 To comment or ask technical questions about this book, send email to: bookquestions@oreilly.com For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com. Find us on Facebook: http://facebook.com/oreilly Follow us on Twitter: http://twitter.com/oreillymedia Watch us on YouTube: http://www.youtube.com/oreillymedia x | Preface
Acknowledgments Many thanks to my long-time editor, Mike Loukides, for suggesting this book in the first place. (Though now he’s going to start pressuring me to get going on the sixth edition of DNS and BIND.) Thanks also to my boss at Infoblox, Steve Nye, who sup- ported the project, and to my old friend and co-conspirator in the Ask Mr. DNS podcast, Matt Larson, who helps keep my DNS skills from atrophying completely. And much credit is due Owen DeLong for his excellent technical review. Most of all, though, thanks to my family: Walt and Greta, Charlie and Jessie, and especially my wife, Paige. They give me both the time to write, and the reason. Preface | xi
(This page has no text content)
CHAPTER 1 DNS and IPv6 Background In early February 2011, the Internet Assigned Numbers Authority, or IANA, assigned the last remaining IPv4 address space to the five Regional Internet Registries (RIRs). As of this writing, the RIRs haven’t yet doled out that address space to carriers and other customers, but it’s clear that the exhaustion of IPv4 address space is imminent. For most organizations on the Internet, the depletion of the Internet’s unallocated IPv4 address space won’t necessitate immediate changes—IPv4 isn’t going anywhere for the foreseeable future. In certain exceptional cases, however, organizations may need to implement IPv6 almost right away: mobile carriers and ISPs seeking to expand their subscriber bases, for example, may need to use IPv6 for new subscribers if they lack additional IPv4 address space to use for expansion. The Internet’s transition from IPv4 to IPv6 has begun. With the US government’s man- date that government agencies move their networks to IPv6, a growing number of users will access the Internet over the new protocol, and an increasing number of resources —websites, name servers, mail servers, and more—will be accessible via IPv6. In some cases, some may only be accessible over IPv6. The transition to IPv6 will take years, maybe decades, to complete. Today, of course, IPv6 is already routed over the Internet: 9% of the Internet’s Autonomous Systems advertise routes to both IPv4 and IPv6 networks. But IPv6 constitutes a tiny fraction of the traffic routed over the Internet. Organizations deploying new IPv6 networks today need to implement transition technologies that enable their IPv6-based devices to reach IPv4-only services. Over time, however, the balance will shift, and so will the responsibility. As IPv6 be- comes the predominant protocol on the Internet, the remaining pockets of IPv4 will need to accommodate IPv6, not vice versa. I imagine the transition playing out some- thing like the move from rotary dialing to Touch-Tone™; in 1963, when the switch began, Touch-Tone™ was a novelty you had to pay extra for. Now, of course, Touch- Tone™ is the norm (unless you’ve already moved on to VoIP) and rotary dialing is a 1
curiosity you have to pay your phone company more to accommodate—if they can still handle it at all. IPv6 and DNS The exhaustion of the IPv4 address space wasn’t unexpected, of course. The Internet Engineering Task Force (IETF) developed IP version 6 in the 1990s largely in anticipa- tion of this day. Likewise, the Domain Name System was extended to accommodate IPv6’s longer IP addresses by adding new record types, and new versions of name serv- ers, including BIND, were released to support those new record types as well as the use of IPv6 to transport queries and responses. At this point, all but ancient BIND name servers support IPv6, though in most cases that support isn’t configured or used. We’ve just been waiting patiently for the protocol to catch on! The ABCs of IPv6 Addresses The most widely known aspect of IPv6, and really the only one that matters to DNS, is the length of the IPv6 address: 128 bits, four times as long as IPv4’s 32-bit address. The preferred representation of an IPv6 address is eight groups of as many as four hexadecimal digits, separated by colons. For example: 2001:0db8:0123:4567:89ab:cdef:0123:4567 The first group, or quartet, of hex digits (2001, in this example) represents the most significant (or highest-order) sixteen bits of the address. In binary terms, 2001 is equiv- alent to 0010000000000001. Groups of digits that begin with one or more zeros don’t need to be padded to four places, so you can also write the previous address as: 2001:db8:123:4567:89ab:cdef:123:4567 Each group must contain at least one digit, though, unless you’re using the :: notation. The :: notation allows you to compress sequential groups of zeros. This comes in handy when you’re specifying just an IPv6 prefix. For example: 2001:db8:dead:beef:: specifies the first 64 bits of an IPv6 address as 2001:db8:dead:beef and the remaining 64 as zeros. You can also use :: at the beginning of an IPv6 address to specify a suffix. For example, the IPv6 loopback address is commonly written as: ::1 or 127 bits of zero followed by a single one bit. You can even use :: in the middle of an address as shorthand for contiguous groups of zeros: 2001:db8:dead:beef::1 2 | Chapter 1: DNS and IPv6
You can use the :: shorthand only once in an address, since more than one would be ambiguous. IPv6 prefixes are specified in a format similar to IPv4’s CIDR notation. As many bits of the prefix as are significant are expressed in the standard IPv6 notation, followed by a slash and a decimal count of exactly how many significant bits there are. So the fol- lowing four prefix specifications are equivalent (though obviously not equivalently terse): 2001:db8:dead:beef:0000:00f1:0000:0000/96 2001:db8:dead:beef:0:f1:0:0/96 2001:db8:dead:beef::f1:0:0/96 2001:db8:dead:beef:0:f1::/96 IPv6 is similar to IPv4 in that it supports variable-length network masks, and addresses are divided into network and host portions. However, in IPv6, there are recommended network masks for networks and subnets: the first 48 bits of an IPv6 address should identify a particular end site and a 64-bit prefix should identify one of up to 65,536 subnetworks at the site identified by the “parent” 48-bit prefix. As of this writing, all global unicast IPv6 addresses on the Internet (addresses that are unique and globally routable) have prefixes that begin with the binary value 001 (equivalent to 2000::/3). These are assigned by Regional Internet Registries (RIRs) and Internet service providers. The prefix itself may be hierarchical, with an RIR responsible for allocating higher- order bits to various ISPs, and ISPs responsible for allocating the lowest-order bits of the prefix to its customers. After the end-site prefix, unicast IPv6 addresses typically contain another 16 bits that identify the particular subnetwork within an end site, called the subnet ID. The re- maining bits of the address identify a particular network interface and are referred to as the interface ID. Here’s a diagram that shows how these parts fit together: | 48 bits | 16 bits | 64 bits | +------------------------+-----------+----------------------------+ | prefix | subnet ID | interface ID | +------------------------+-----------+----------------------------+ / \ | +------------------------------------\ | 3bits | 9bits | 12-20bits | 16-24bits | +----------+----------+--------------+--------------------------+ | IETF | IANA | RIR | RIR or ISP | +----------+----------+--------------+--------------------------+ As you can see in the diagram, the 48-bit prefix is made up of several parts. As previously mentioned, the first three bits are assigned by IETF to indicate “Global Unicast Space.” The next nine bits are assigned by IANA to a particular RIR (for example, 2620::/12 is assigned to ARIN, the American Registry for Internet Numbers). The RIR then assigns prefixes to ISPs and end users ranging from 24 to 48 bits (the RIR controls between 12 The ABCs of IPv6 Addresses | 3
and 36 bits). Finally, in an ISP’s address space, the ISP can assign the bits after its RIR- assigned prefix up to the /48 allocated to each customer end site. Coincidentally, Movie University just arranged to get IPv6 connectivity from our ISP. The ISP assigned us a /48-sized IPv6 network, 2001:db8:cafe::/48, which we’ll subnet using the scheme just described into /64-sized subnetworks. What’s this fe80:: address? If you’re poking around on a Unix or Linux system with ifconfig, net- stat or the like, you may notice that your host’s network interfaces al- ready have IPv6 addresses assigned to them, starting with the quartet “fe80.” These are link-local scoped addresses, derived automatically from the interfaces’ hardware addresses. The link-local scope is signif- icant—you can’t access these addresses from anywhere but the local subnet, so don’t use them in delegation, masters substatements, and the like. Use global unicast addresses assigned to the host instead. You probably shouldn’t even use link-local addresses in the configuration of resolvers on the same subnet if there’s any chance that those resolvers will move (e.g., if they’re on laptops or other mobile devices). IPv6 Forward and Reverse Mapping Clearly, DNS’s A record won’t accommodate IPv6’s 128-bit addresses; an A record’s record-specific data is a 32-bit address in dotted-octet format. The IETF came up with a simple solution to this problem, described in RFC 1886. A new type of address record, AAAA, was used to store a 128-bit IPv6 address, and a new IPv6 reverse-mapping domain, ip6.int, was introduced. This solution was straightfor- ward enough to implement in BIND 4. Unfortunately, not everyone liked the simple solution, so they came up with a much more complicated one. This solution introduced the new A6 and DNAME records and required a complete overhaul of the BIND name server to implement. Then, after much acrimonious debate, the IETF decided that the new A6/DNAME scheme involved too much overhead, was prone to failure, and was of unproven usefulness. At least temporarily, they moved the RFC that describes A6 records off the IETF standards track to experimental status, deprecated the use of DNAME records in reverse-mapping zones, and trotted old RFC 1886 back out. Everything old is new again. For now, the AAAA record is the way to handle IPv6 forward mapping. The use of ip6.int is deprecated, however, mostly for political reasons; it’s been replaced by ip6.arpa. 4 | Chapter 1: DNS and IPv6
AAAA and ip6.arpa The AAAA (pronounced “quad A,” not “ahh!”) record, described in RFC 1886, is a simple address record with record-specific data that’s four times as long as an A record, hence the four As in the record type. The AAAA record takes as its record-specific data the textual format of an IPv6 address, exactly as described earlier. So for example, you’d see AAAA records like this one: ipv6-host IN AAAA 2001:db8:1:2:3:4:567:89ab As you can see, it’s perfectly okay to use shortcuts in the IPv6 address, including drop- ping leading zeroes from quartets and replacing one or more contiguous quartets of all zeroes with ::. RFC 1886 also established ip6.int, now replaced by ip6.arpa, a new reverse-mapping name space for IPv6 addresses. Each level of subdomain under ip6.arpa represents four bits of the 128-bit address, encoded as a hexadecimal digit just like in the record-specific data of the AAAA record. The least significant (lowest-order) bits appear at the far left of the domain name. Unlike the format of IPv6 addresses in AAAA records, omitting leading zeros is not allowed, so there are always 32 hexadecimal digits and 32 levels of subdomain below ip6.arpa in a domain name corresponding to a full IPv6 address. The domain name that corresponds to the address in the previous example is: b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. These domain names have PTR records attached, just as the domain names under in-addr.arpa do: b.a.9.8.7.6.5.0.4.0.0.0.3.0.0.0.2.0.0.0.1.0.0.0.0.8.b.d.1.0.0.2.ip6.arpa. IN PTR mash.ip6.movie.edu. Adding AAAA Records to Forward-Mapping Zones A and AAAA records can coexist side-by-side in any forward-mapping zone. So, for example, if your host has both an IPv4 and an IPv6 address (commonly called a “dual- stack” host), you can attach both A and AAAA records to its domain name: suckerpunch IN A 192.249.249.111 IN AAAA 2001:db8:cafe:f9::d3 However, you should be careful with that configuration, at least for the time being. Some current resolvers will always look up AAAA records before A records, even if the host running the resolver lacks the ability to communicate with all IPv6 addresses (for example, the host only has a link-local IPv6 address, or uses some transition technology that gives it limited IPv6 connectivity). If you attach both A and AAAA records to a single domain name, as in the example above, a user of one of these broken resolvers would need to wait for his connection to the IPv6 address to time out before successfully connecting to the IPv4 address, which could take as long as a few minutes (see“Han- dling Broken Resolvers” in Chapter 2 for a mechanism to help you deal with this). Adding AAAA Records to Forward-Mapping Zones | 5
Until these broken resolvers are fixed, it’s prudent to attach A and AAAA records to different domain names, at least for hosts offering services: suckerpunch IN A 192.249.249.111 suckerpunch-v6 IN AAAA 2001:db8:cafe:f9::d3 If you like the aesthetics better, you can use “v6” as a label in the domain name instead of as a suffix to the hostname: suckerpunch.v6 IN AAAA 2001:db8:cafe:f9::d3 Note that this doesn’t require that you create a new subzone called v6.movie.edu; a subdomain in the same zone will do nicely. IPv6 Reverse-Mapping Zones If you use the standard IPv6 subnetting scheme shown in the diagram in “The ABCs of IPv6 Addresses”, the reverse-mapping zones that correspond to your subnets will have 18 labels. For example, the subnet that suckerpunch.v6.movie.edu is on, 2001:db8:cafe:f9::/64, would correspond to the reverse-mapping zone 9.f.0.0.e.f.a.c. 8.b.d.0.1.0.0.2.ip6.arpa. Remember that DNS is case-insensitive, so we could also have called the zone 9.F.0.0.E.F.A.C.8.B.D.0.1.0.0.2.IP6.ARPA or even 9.F.0.0.e.F.a.C. 8.b.D.0.1.0.0.2.iP6.aRpA, if we’d been feeling punchy. They all would have handled reverse mapping of IPv6 addresses just as well. As with IPv4 reverse-mapping zones, IPv6 reverse-mapping zones mostly contain PTR records. And as with any zone, they must contain one SOA record and one or more NS records. Here’s what the beginning of that zone looks like: $TTL 1d @ IN SOA terminator.movie.edu. hostmaster.movie.edu. ( 2011030800 ; Serial number 1h ; Refresh (1 hour) 15m ; Retry (15 minutes) 30d ; Expire (30 days) 10m ) ; Negative-caching TTL (10 minutes) IN NS terminator.movie.edu. IN NS wormhole.movie.edu. 3.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0 PTR suckerpunch.v6.movie.edu. 4.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0 PTR super8.v6.movie.edu. Here’s hoping that most of your hosts will use dynamic update to register their own AAAA and PTR records, or else you’re going to wear out the period key on your key- board. If you’re going to add a lot of PTR records to an IPv6 reverse-mapping zone by hand, it’s a good idea to make liberal use of the $ORIGIN control statement. For example, you could rewrite those last two PTR records as: 6 | Chapter 1: DNS and IPv6
Comments 0
Loading comments...
Reply to Comment
Edit Comment