Airprint across subnets(2)

按:这是Ashish的另外一篇,发布在Google sites上的有关AirPrint在企业环境中的配置。

原文地址:Airprint across subnets

Your company decided to deploy iPad/iPhone. 
Now you want to print from the device onto your corporate printer.
You ask Apple and get the usual answer, its not supported.
Hopefully the solutions described below will provide you with a solution.


iPad/iPhone use bonjour to discover printers.
Bonjour uses broadcasting, so odds are you cannot see stuff outside the wireless subnet
What you need to do is add a bunch of entries into your DNS and setup a CUPS printserver.
This will now allow the iOS device to discover printers and send print requests.

Assumptions:

Your internal DNS domain is: foocompany.com

We are going to setup a new subdomain called bonjour.foocompany.com
This allows us to play with DNS.
More importantly, you can use DNS views and show printers relative to the subnet address from where the DNS queries come from.
IE: Building A has subnet A1, Building B has subnet B1. 
If a customer is in Building B, you only want to show printers in Building B.
Assuming when a customer is in Building B, they are on subnet B1, you can create a view in DNS that says when 
the client ipaddress (of the DNS request) is in subnet B1, used the following DNS entries.

In this case I use a Ubuntu Linux server to test out DNS and CUPS.


SETUP

Setup a test DNS server which forwards all requests to your primary DNS server while supporting the test entries that you
need to play with.
Setup your /etc/bind/named.conf as follows, replace everything that is UPPERCASE with your site specific stuff

options {
        directory "/var/cache/bind";
        forwarders { REALDNSSERVER_IPADDR1 ; REALDNSSERVER_IPADDR1 ;  };
        forward first;
        allow-query-cache { any; };  // Allow client queries from other subnet to query from cache
        auth-nxdomain no;    # conform to RFC1035
        recursion yes;
};
zone "bonjour.FOOBAR.COM." {   type master; file "/etc/bind/db.home"; };
zone "FOOBAR.COM" { type forward; forward only; forwarders { REALDNSSERVER_IPADDR1 ; REALDNSSERVER_IPADDR1 ;  };  };



setup your /etc/bind/db.home file

$TTL 60
@ SOA ns.bonjour.FOOBAR.COM. hostmaster.bonjour.FOOBAR.COM. (2006010102 10800 3600 604800 1)
        NS ns.bonjour.FOOBAR.COM.
ns      IN A    YOURTESTDNSSERVER_IPADDR

printserver IN A YOURCUPSPRINTSERVER_IPADDR
lb._dns-sd._udp                 IN PTR @
b._dns-sd._udp                  IN PTR @


_cups._sub._ipp._tcp            IN PTR pname1._printer._tcp
_universal._sub._ipp._tcp       IN PTR pname1._printer._tcp

_cups._sub._ipp._tcp            IN PTR pname2._printer._tcp
_universal._sub._ipp._tcp       IN PTR pname2._printer._tcp

pname1._printer._tcp                 IN SRV 0 0  631 printserver
pname2._printer._tcp        IN SRV 0 0  631 printserver

pname1._printer._tcp         IN TXT     ( "txtvers=1"  "qtotl=1"  "rp=printers/PRINTERNAME1" "adminurl=http://printserver:631/printers/PRINTERNAME1
6_LJ" "ty=HP Laserjet PRINTERNAME1"  "product=(HP LaserJet 4200)"  "transparent=t"  "copies=t"  "duplex=t"  "color=f"  "pdl=application/octet-stream,
application/pdf,application/postscript,image/jpeg,image/png,image/urf" "URF=W8,SRGB24,CP1,RS600" )

pname2._printer._tcp                IN TXT     ( "txtvers=1"  "qtotl=1"  "rp=printers/PRINTERNAME2" "adminurl=http://printserver:
631/printers/PRINTERNAME2" "ty=HP PRINTERNAME1"  "product=(HP color LaserJet 4650)"  "transparent=t"  "copies=t"  "duplex=t"  "
color=t"  "pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/urf" "printer-type=0x801046" "URF=W8,SRGB24,CP1,RS600" )


Setup your CUPS server to print to a printer. See http://www.cups.org/
Assuming you setup a printer in CUPS with the queue name PRINTERNAME1, you need to put the same name in DNS above.
In the "product=" key you need to put the model info from the PPD file /etc/cups/ppd/PRINTERNAME1.ppd . 
    grep "*Product:" /etc/cups/ppd/PRINTERNAME1.ppd
Just pick one of many choices for model name, the iPAD does not use it, however OSX on Mac's does.

The "ty=" key is used in OSX to display a user friendly name
iPAD however uses the DNS name, in this case the stuff before the "_printer._tcp" part.


In CUPS ensure that the printer queue is accessible from your Intranet. 
You can check by navigating to http://printserver.bonjour.FOOBAR.COM:631
You should have something like this in your config file  /etc/cups/cupsd.conf

ServerAlias *
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
AccessLog syslog
AccessLogLevel all
LogLevel debug
MaxLogSize 0
SystemGroup lpadmin
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseRemoteProtocols CUPS
BrowseAddress @LOCAL
BrowseLocalProtocols CUPS dnssd
BrowseProtocols all
DefaultAuthType Basic


Now setup your ipad network config to point to your test DNS server and add "bonjour.FOOBAR.COM" in your DNS search path.
Try to print from the Photo application.

Good luck! 

If found this information useful, please shoot me an email. It nice to hear that this helped someone.


Thanks you for visiting.
Ashish
mailto:[email protected]



If you found this REALLY useful and would like to donate some money for future research I would highly appreciate it ;-)


你可能感兴趣的:(server,tcp,osx,File,HP,recursion)