Zero Configuration Networking Bishop Paper
Zero Configuration Networking Bishop Paper
Multi-cast DNS
Advertising Meta-data
DNS
Zeroconf works by resting atop standard DNS queries. Software on your computer
has the ability to “advertise” that it’s listening on a port. To make this advertisement,
the software installs standard DNS records in a DNS server. Included in the
advertisement is:
• the address of the advertising machine
• the port that is waiting for a connection
• The “service-type” of the listening connection, (ie. Is it a printer? Web-server?)
• A Human-Readable Name associated with the advertisement.
pub.acme.com
goof.acme.com
I know one at pub.acme.com:8080
called "Personal Web"
Do you know any
webservers?
pub.acme.com
At this point, we already have something very interesting. All the infrastructure is in
place for users to browse for specific types of services (in this case “webservers”).
Also interesting is that the identifier of a service is no longer a network address. It has
been replaced by a Human-Readable Name.
Multi-cast DNS
While Zeroconf can talk to standard DNS servers (called “wide-area service
discovery”), the most common use of Zeroconf is to rest atop a special type of DNS
server called a “multi-cast” DNS server. A multi-cast DNS (mDNS) server is a
distributed DNS server that exists simply because all the machines on a local subnet
run a special daemon. The daemons collectively create a DNS server that is
responsible for a new top-level domain called “.local”.
With multi-cast DNS, every machine has a domain name and an IP address, even in
the absence of a standard DNS server. Daemons running on either sides of a router
can’t discover each other, so the .local domain is restricted to the local-link.
= the daemon
goof.local
(also goof.acme.com)
PowerBook G4
papasmurf.local
DNS (no other address)
.local
pub.local
(also pub.acme.com)
goof.local
I know one at pub.local:8080
called "Personal Web"
Do you know any
I've got a webserver webservers?
listening on port 8080
called "Personal Web"
DNS
.local
pub.local
Advertising Meta-data
Advertisements can include one more piece of data which is an arbitrary set of key-
value pairs called “TXT Records”. This is a very powerful construct because each
service-type can have their own standard for what TXT Record keys are exported. For
instance, a printer service may export the physical location of the printer in a TXT
Record using the key “location”.
I've got a printer listening on port 478
called "Gutenberg"
location="Next to the Kitchen"
DNS
.local
gutenberg.local
The Perforce Server will use these TXT records to include descriptions of servers in
its advertisements.
Advertising a Service
Perforce has defined a set of standard flags intended to work for p4d, p4p, p4web, and
p4ftp.
Flags
–0 The “advertise” flag. (“Dash-zero”)
Advertising is not on by default, so this flag must be set to
allow other clients to browse for the service. Without the name
flag (described below), a default name (most likely the machine
name) will appear in browse lists.
–In <name> The “name” flag.
This flag assigns a human-readable name to a service. When
used with Zeroconf, browsing clients will see it in a list. p4d
will also output this value when called with the command p4
info -ztag.
Example
p4d -0 –In “Skunkworks Group” -Id “The server devoted to internal
secret projects”
P4D
-0
-In "Main Development"
-Id "Development only. Check your
core dumps into the debugging Main Development Development only. Check your core dumps in
Perforce 日本 メーン・デバ・サーバー
server"
P4D
-0
-In "Perforce 日本"
-Id "メーン・デバ・サーバー"
Example
> p4d -0 –In “Test Server” &
Example
> p4 -p localhost:1666 info
P4D
P4WEB
It is also possible to have a Perforce Server that doesn’t advertise, and a proxy and
p4web instance that do advertise.
P4D P4P
-p perforce:1666 -t perforce:1666 -0 -In "Proxy" (P4V finds "Proxy")
P4WEB
P4D
perforce
acme.com
P4P
acme.co.uk
ClientAPI Changes
There are no changes to the API. The P4PORT resolution is built-in to the Perforce
client libraries, so all clients will benefit.
Service types
In the world of Zeroconf, each service that can be browsed is identified by a “service
type”. In the conceptual diagrams in the overview, the web-server type was described
as “webserver”, but the actual service types are a little more obtuse. For example, if
you were to browse for web servers, the service type would be _http._tcp.
All standard service types can be found at an online registry, located at:
http://www.dns-sd.org/ServiceTypes.html
Perforce has registered _p4._tcp as the service-type for their protocol. If you write
code to browse for Perforce servers, you’ll need to specify this as the service type.
The P4Web advertisement conforms to the _http._tcp service type. If you browse for
_http._tcp, you’ll discover all the web-servers on your local network.
But what if you wanted to discover only P4Web instances? The Zeroconf standard
describes a way of specifying a “sub-type” of a service type using a comma-notation
(shown below). P4Web can advertise using a sub-type of “p4” so to specifically
browse for P4Web, use the subtype notation.
_http._tcp,p4
service-type sub-type
TXT Records
version X X X X “P4D/MACOSX104X86/2007.2/122958”
target X X X “perforce.acme.com:1666”
“Test Server”