Unable to connect to a printer using a CNAME record

Good morning AskPerf!  My name is Sandeep Bhatia and I work with Networking team here in Microsoft Support.  In today’s post, we will discuss Print issues when using a CNAME on Windows 2008 R2 Server, with a non-Microsoft DNS Servers.

When you connect a printer hosted on Windows 2008 R2 Server using a CNAME alias it returns the following error:

Operation could not be completed (Error 0x0000079). Double check the printer name and make sure that the printer is connected to the network.

clip_image002

This error is returned because of the optimization changes to the spooler service in Windows 2008 R2 Server.  The Print Spooler service uses the local names to service requests.  We’ve verified the name being used is correct and we can connect using the NetBIOS, FQDN and IP address of the server.

Step one is to make sure the target print server has the DNSOnWire registry key set to 1:

HKLM\SYSTEM\CurrentControlSet\Control\Print\DNSOneWire (REG_DWORD)

More details about this registry key is available at KB979602

However, if the DNS Server that the Print server is using is not a Windows based DNS Server we could still see a similar error issue because of how the DNS server formats the reply.  When the DNSOnWire registry key is set to 1, the Print Server on startup will send a recursive DNS query expecting to get both the host record (A) the CNAME refers to and the IP address of the host.

A sample DNS request and reply would look something like this:

Printserver.contoso.com Dnsserver.contoso.com DNS DNS:QueryId = 0x1389, QUERY (Standard query),

This will query for printservercname.contoso.com of type ALL on class Internet.

When the type is set to ALL, the client would expect all the information about the record in on packet.  This query is also a recursive query to the DNS server for the name printservercname.contoso.com.

The second step is to make sure is the DNS server supports both a query type of ALL as well as recursive queries. The DNS server should be compliant with RFC 1035.

In this example of a non-compliant DNS response, the reply from the DNS Server to the Print server for the DNS query, the DNS Server did not respond back with the IP Address of the Print Server.  It does send back the CNAME entry which points to the Print Server’ Host record, but the expectation is both should be returned.

Dnsserver.contoso.com Printserver.contoso.com DNS DNS:QueryId = 0x1389, QUERY (Standard query), Response - Success, Array[IP Address Of the DNS Servers] {DNS:242, UDP:241, IPv4:240}

  - Flags:  Response, Opcode - QUERY (Standard query), AA, RD, RA, Rcode - Success

     RD:                (.......1........) Recursion desired

  - ARecord: printservercname.contoso.com of type CNAME on class Internet: Printserver.contoso.com

     ResourceName: printservercname.contoso.com

    ResourceType: CNAME, Canonical name for an alias, 5(0x5)

     ResourceClass: Internet, 1(0x1)

     TimeToLive: 1800 (0x708)

     ResourceDataLength: 15 (0xF)

     CName: Printserver.contoso.com

  + AuthorityRecord: in.Contoso.com of type NS on class Internet: DNSServer.Contoso.com

  + AdditionalRecord: DNSServer.Contoso.com of type Host Addr on class Internet: 192.168.1.100

 

Under an ideal scenario, the reply for a recursive query from the DNS Server should look more like:

Dnsserver.contoso.com Printserver.contoso.com DNS DNS:QueryId = 0x1389, QUERY (Standard query), Response - Success, Array[IP Address Of the DNS Servers] {DNS:242, UDP:241, IPv4:240}

  + Flags:  Response, Opcode - QUERY (Standard query), AA, RD, RA, Rcode - Success

  - QRecord: Printservercname.contoso.com of type ALL on class Internet

     QuestionName: printserver.contoso.com

     QuestionType: A request for all records, 255(0xff)

     QuestionClass: Internet, 1(0x1)

  - ARecord: printservercname.contoso.com of type CNAME on class Internet: printserver.contoso.com

     ResourceName: printservercname.contoso.com

     ResourceType: CNAME, Canonical name for an alias, 5(0x5)

     ResourceClass: Internet, 1(0x1)

     TimeToLive: 3600 (0xE10)

     ResourceDataLength: 15 (0xF)

     CName: printserver.contoso.com

  - AdditionalRecord: printserver.contoso.com of type Host Addr on class Internet: 192.168.1.110

     ResourceName: printserver.contoso.com

     ResourceType: A, IPv4 address, 1(0x1)

     ResourceClass: Internet, 1(0x1)

     TimeToLive: 1200 (0x4B0)

     ResourceDataLength: 4 (0x4)

     IPAddress: 192.168.1.100

The key takeaway is that the configured DNS Server must return both the CNAME information and the IP Address of the Host in the same response in order to use printing to a CNAME successfully.

-Sandeep Bhatia

Additional Resources: