Sub topic 10
Network Printing: IP Addressing, Ports and Protocols
This chapter assumes you know what an IP address, a router and Wi-Fi are. It also assumes you can use Settings or Control Panel in Windows. It covers how a computer finds a network printer, which ports and protocols carry the print job, and how to test the connection.
How a network printer is reached
A network printer has its own network interface. It gets an IP address like any other host. A computer sends the print job to that address over a TCP/IP port. The printer does not need to be attached to any computer.
IP addressing for printers
A printer can get its address in two ways:
- DHCP assigns the address automatically. This is easy, but the address can change after a reboot or lease expiry. A computer that stored the old address then fails to print.
- Static address is set by hand on the printer, or reserved for it in the DHCP server. Printers are usually given a static address or a DHCP reservation so the address never changes.
Reserving the address in DHCP is common in offices because it keeps central control and still gives a fixed address.
Common ports and protocols
| Name | Port | Purpose |
|---|---|---|
| Raw / JetDirect / AppSocket | TCP 9100 | Sends the job straight to the printer. Default for a Standard TCP/IP port in Windows. |
| LPD/LPR | TCP 515 | Older Unix-style queue protocol. |
| IPP | TCP 631 | Internet Printing Protocol. Used by CUPS and driverless printing. |
| SMB | TCP 445 | Windows file and printer sharing. |
The Standard TCP/IP port in Windows uses raw port 9100 unless you change it. IPP is a newer standard. It supports status reporting and encryption, and many modern printers support it without a vendor driver.
Discovery
Computers can find printers in several ways:
- Bonjour (mDNS) is Apple's zero-configuration discovery. It lets a Mac or iPhone see nearby printers with no setup.
- WSD (Web Services for Devices) lets Windows discover printers on the local network.
- AirPrint is Apple's driverless printing built on IPP and Bonjour.
Discovery normally works only inside one subnet, because the discovery messages are not forwarded by routers. If a printer sits on a different subnet, add it by IP address.
Adding a network printer by IP address
This PowerShell example creates a port for the printer and then adds the printer. The Generic / Text Only driver stands in for a vendor driver.
Add-PrinterPort -Name "IP_192.168.1.50" -PrinterHostAddress "192.168.1.50"
Add-Printer -Name "Office Printer" -DriverName "Generic / Text Only" -PortName "IP_192.168.1.50"Testing the connection
When printing fails, first check whether the network path works. This command tests raw port 9100.
Test-NetConnection -ComputerName 192.168.1.50 -Port 9100If TcpTestSucceeded is True, the network and the printer's port are reachable. The fault is then more likely the driver or the queue. If it is False, check the cable or Wi-Fi, the printer's IP address, and any firewall between the two.
Common errors
- The printer's address changed after DHCP renewed it, so the port points at the wrong host.
- The printer and computer are on different subnets or VLANs, so discovery fails.
- The port is set to the wrong protocol, such as LPR when the printer expects raw.
- A firewall blocks TCP 9100, 515 or 631.
Exercise
A user's network printer stopped working after a power outage. The computer's port still points at 192.168.1.50. A test of port 9100 to that address fails. What is the most likely cause, and how do you prevent it?
Show answer
The printer probably received a new address from DHCP when it restarted, so the old address is no longer valid. Find the new address on the printer's configuration page and update the port. To prevent it, give the printer a static IP address or a DHCP reservation.