Zero Configuration Networking: The Definitive Guide
5.1. Domain Enumeration
When you browse on the local network, it's clear that the domain you want is local. When you browse on the Internet, you can ask DNS-SD to browse in any valid DNS domain, like apple.com or oreilly.com. Whether you get any results will depend on whether the domain is advertising any services. Clearly, one way to decide which domain(s) to browse is to have the user type them in. However, the spirit of Zeroconf is zero configuration, so we don't want to make the user start manually configuring things now. The computer should automatically learn from its environment about interesting domains to browse. The way DNS-SD does this is with Domain Enumeration queries. DNS-SD performs five Domain Enumeration queries:
When your laptop finds itself on a new network, it typically learns certain information from the DHCP server, including the address it's been assigned, the netmask for that network, the address(es) of one or more DNS services, and the default DNS search domain recommended for users on that network. DNS-SD uses this information to construct its Domain Enumeration queries in two ways: domain- and address-based . The first way is a domain-based query. DNS-SD takes each of the five Domain Enumeration query strings above, appends the default DNS search domain, and does a PTR query. For example, at Apple, the DHCP server informs clients that the domain is apple.com, so DNS-SD will do a PTR query for lb._dns-sd._udp.apple.com. to determine if browse operations done by legacy clients should browse any other domain in addition to local. The second way is an address-based query, which allows more fine-grained, location-specific defaults to be fed to clients based on which network segment they are on. DNS-SD does address-based queries by taking the client's IP address and performing a logical AND operation with the netmask to get the base address for the subnet. This address is then reversed in the manner of a normal in-addr.arpa reverse lookup, and this name is then appended to each of the Domain Enumeration query strings. For example, if the client's IP address is 192.168.1.2 and the netmask is 255.255.0.0, then the base address for the subnet is determined to be 192.168.0.0, and DNS-SD will do a PTR query for lb._dns-sd._udp.0.0.168.192.in-addr.arpa. to determine if there's a recommended legacy browse domain for that particular network. |
Категории