A pure network printer can happily disappear unobtrusively into a corner of the room and serve multiple users on the LAN. The convenience, flexibility, and invisibility of network printers is one reason why they have replaced their USB counterparts in many offices. Thanks to a mini computer Raspberry Pi, which can provide a print server service for your old USB hulk, the old printer has now a new function. With a wireless adapter plugged into your rPi (or by using rPi3), the location of your printer depends only on wireless reception and a suitable power supply.
We first need to get a bit acquainted with the different server/client components.
There are several protocols that manages printing on a network today. Most commonly are:
Line Printer Daemon protocol (LPR/LPD over TCP 515)
Internet Printing Protocol (IPP over TCP/UDP 631)
Server Message Block / Common Internet File System (through MSRPC)
We also need specialized server softwares which will be used for configuring and maintaining print- and/or file-sharing through these protocols, like CUPS and SAMBA.
Line Printer Daemon protocol
LPD is the original network printing protocol and is supported by many network printers. Due to limitations in the LPD protocol, it is not recommended to use it if the printer or server supports one of the other protocols. LPD printing normally happens over port 515 and uses these lpd URI scheme:
In short, unless you have a really old printer/system, use IPP (or in conjunction with SAMBA if file-sharing is wanted on the same server).
Internet Printing Protocol
Internet printing (IPP) on the other hand uses bidirectional communication which gives us more feedback and control, and also makes it possible for client computers to use printers that are virtually anywhere in the world by sending print jobs using Hypertext Transfer Protocol (HTTP). IPP allows users access to several options when printing over a network including identifying the printer’s capability, submit printing project to a specific printer, identify the availability of a printer and cancel a job that was submitted to a specific printer.
Furthermore, it supports security features such as encryption and authentication, performance features such as streaming and compression, managed printing features such as PIN printing, quotas, and paid printing, ICC color management in printing, and other printing features.
The protocol was originally the brainchild of Novell, who presented the idea to several printer manufacturers. Xerox and others joined in on the project in 1996, with Xerox and Novell presenting the initial project information. Today it is maintained and promoted by the Printer Working Group. There are several specific operating programs that utilize IPP as a printer function. Among the available products are the CUPS, or Common UNIX Printing System, which operates on Mac OS X and Linux systems. Novell iPrint and Microsoft Windows, beginning with Windows 2000 also utilize IPP for printers.
Printing normally happens over port 631 (or 443 if the connection is secured) and uses these http, ipp, and ipps URI schemes:
Source for URI schemes: cups.org
Common Unix Printing System
CUPS manages print jobs and queues and provides network printing using the standard Internet Printing Protocol (IPP), while offering support for a very large range of printers, from dot-matrix to laser and many in between. Other protocols includes LPD, SMB, AppSocket a.k.a. JetDirect, some with reduced functionality. It is meant to promote a standard printing solution for all UNIX vendors and users, and also supports PostScript Printer Description (PPD) and auto-detection of network printers, and features a simple web-based configuration and administration tool. CUPS acts as a service daemon on a *nix system.
The company Easy Software Products that started on CUPS in ’97, released the first beta in early ’99, and it was quickly adopted as default printing system for most Linux distributions. In early 2007, Apple Inc. hired chief developer Michael Sweet and purchased the CUPS source code.
Server Message Block / Common Internet File System
The SMB is a network file sharing protocol and a client-server implementation, and although its main purpose is file sharing, it can also be used as network printing. SMB was originally an IBM DOS product that Microsoft combined with OS/2 technology to form CIFS (and then later renamed back to SMB). The set of message packets that defines a particular version of the protocol is called a dialect.
CIFS is an enhanced version of Microsoft’s open, cross-platform Server Message Block protocol. CIFS is actually a virtual file system (just like smbfs was), a network filesystem that provides access to files and directories on another computer as if they were on a locally attached disk.
“The 2.6 version of kernel introduced a new file system driver cifs.koto mount to Windows and Samba servers and run demanding applications from those mounts. Although commonly used to mount to non-Linux servers, such as Windows, the cifs virtual file system client [cifs vfs] is optimized for Samba and servers which implement the CIFS POSIX extensions. CIFS is a great alternative to NFS and other network file systems in certain workloads.
“”In earlier versions of Linux the only alternatives for accessing Linux or Windows servers were:
- using the smbclient tool, a user space application with ftp like semantics
- mounting with smbfs, a more limited smb client kernel filesystem diver which provided only partial POSIX semantics
- Installing nfs on the server, and mounting with Linux’s nfs client (which does not have an oplock based cache consistency mechanism, and has a more limited security model). Although NFSv4 addresses some of these NFS version 2 and 3 deficiencies, it is not widely deployed, and is unavailable on some platforms.”
So historically, the SMB File System itself is now long gone. For all intent and purposes; “CIFS” is now being used as a name for the SMB protocol in general (all dialects) and, additionally, the suite of protocols that support and include SMB on *nix systems. When mounting shares we use strictly cifs (either manually or through fstab).
Samba is a software suit implementation of the SMB / CIFS protocols for *nix systems, providing support for cross-platform file and printer sharing with Windows, OS X, and other Unix systems. Samba is standard on nearly all distributions of Linux and is commonly included as a basic system service on other Unix-based operating systems as well. SAMBA was originally SMB Server – but the name had to be changed due to SMB Server being an actual MS product.
If someone is sharing out SMB via Samba to a legacy system still using NetBIOS it will most likely connect to the Samba server via port 137, 138 and 139. CIFS is strictly port 445 (Without NetBIOS), and SMB port 445 over TCP. NetBIOS on the LAN can be an annoyance due to the amount of broadcasts that it sends. However, NetBIOS over the Internet is an enormous security risk. The NetBIOS protocol gives people the ability to obtain all kind of information from your systems like: your domain, workgroup and system names, as well as account information. To prevent this from happening make sure that on your border gateways/routers filter out all in- and outgoing traffic for ports 137, 138 and 139.
Within SAMBA’s /ect/samba/smb.conf this can be controlled under [global] by:
disable netbios = yes
smb ports = 445
Next is Part 2 – Setting up the rPi Print-Server and clients…