Sub topic 10
Network Printing: IP Addressing, Ports and Protocols
This chapter assumes you can read an IPv4 address and subnet mask, know what DHCP does, and can open Printers & scanners in Windows Settings. It covers how a computer finds a network printer, which port and protocol carry the job, and how to prove where a failure sits.
How a network print job travels
A network printer has its own network interface, either Ethernet or Wi-Fi. It gets an IP address like any other host. A computer sends the job across the network to that address, and the printer's interface listens on a TCP port for it.
Three things must line up for a job to print:
- The computer can reach the printer's IP address.
- The computer sends to the TCP port the printer listens on.
- Both sides agree on the protocol and the page description language (covered in a later chapter).
A fault in any one produces a stuck or failed job.
IP addressing for printers
A printer needs an address that does not change. Most Windows printer ports store an IP address, not a name. If the printer gets a new address, every computer pointing at the old one stops printing.
| Method | How it works | Trade-off |
|---|---|---|
| Static IP | You type the address, mask and gateway on the printer's panel or web page. | Stable, but you must track it and keep it outside the DHCP range. |
| DHCP reservation | The DHCP server always hands the same address to the printer's MAC address. | Stable and managed centrally. Preferred in most offices. |
| Plain DHCP | The printer takes any free address. | The address can change after a reboot or lease expiry, which breaks IP-based ports. |
| APIPA | With no DHCP answer, the printer picks an address in 169.254.0.0/16. | Only works with hosts on the same link. A 169.254.x.x address means DHCP failed. |
A printer on a different subnet or VLAN from the client needs routing between them. Wireless printers are often on a guest or IoT network that isolates them from the office LAN. In that case the printer looks fine but is unreachable.
A hostname can replace the IP address in the port, as long as DNS resolves it. This survives address changes better, but then a DNS failure also breaks printing.
Ports and protocols you must know
A port number identifies the service on the printer. The A+ exam expects you to recognize these.
| Port | Protocol | Use |
|---|---|---|
| 9100 | RAW / JetDirect (TCP) | Sends the job straight to the printer with no extra negotiation. Default for the Standard TCP/IP port in Windows. |
| 515 | LPD/LPR (TCP) | Line Printer Daemon. Older, queue-based protocol, common with Unix and Linux. |
| 631 | IPP (TCP) | Internet Printing Protocol. Used by CUPS, AirPrint and driverless printing. Can be encrypted (IPPS). |
| 445 | SMB (TCP) | File and printer sharing between Windows computers. Used when a client connects to a shared printer on another PC or server. |
| 80 and 443 | HTTP and HTTPS | The printer's built-in web page for configuration. |
| 161 | SNMP (UDP) | Lets software read printer status, such as toner level and errors. |
Some related technologies do not use a single fixed port:
- WSD (Web Services for Devices) is how Windows discovers and talks to many printers automatically on the local network.
- Bonjour (mDNS) advertises printers on the local network. Apple's AirPrint uses it with IPP, so no driver install is needed.
- Mopria is a similar driverless standard for Android and other systems.
Raw 9100 sends the data and nothing else. If the printer is busy or the job is malformed, you get little feedback. LPR and IPP offer queue names and status, and IPP adds authentication and encryption.
Direct IP printing versus a print server
There are two common designs.
- Direct IP printing. Each client has its own port pointing at the printer's address. Each client also needs its own driver. This is simple, but a change in the printer means touching every client.
- Shared printer through a print server. Clients connect to a computer or server that holds the queue and driver, and that machine forwards the job to the printer. The server can distribute drivers and apply permissions. Clients usually reach it by SMB, using a path like
\\PRINTSRV\Office Printer.
A print server can also be a small hardware box or a feature built into the printer. It adds the network interface to an older USB or parallel printer.
Adding a network printer in Windows
In Settings you can pick Add a printer or scanner and let Windows find the device. If it is not found, choose Add a printer using an IP address or hostname. Windows then creates a Standard TCP/IP port.
The same job from PowerShell has two steps. First create the port, then create the printer that uses it:
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"The generic driver is a stand-in. In practice you would install the vendor driver first and use its name here. To review what is installed, list each printer with its driver and port:
Get-Printer | Select-Object Name, DriverName, PortName, PrinterStatusCheck the PortName column when a printer stops working. It tells you which address the computer is trying to reach.
To see the ports themselves, including the address each one points to, use:
Get-PrinterPort | Select-Object Name, PrinterHostAddress, PortNumberTesting the path
When a network printer will not print, test the network before you touch drivers. Work from the bottom up.
- Check the printer. Look at its panel. Does it show an IP address, and is it the one you expect?
- Ping the address. A reply shows basic reachability. Some printers or firewalls drop ping, so a failed ping is a clue and not proof.
- Test the print port. A TCP test to the real port is stronger than ping:
Test-NetConnection -ComputerName 192.168.1.50 -Port 9100If TcpTestSucceeded is True, the network path and the printer's listening service work. The fault is then in the driver, the queue or the job. If it is False, the problem is the network or the printer: wrong address, wrong subnet, a firewall, a printer asleep or off, or a cable or Wi-Fi fault.
Common errors
- Printer works for some users but not others. The failing users may be on another subnet or VLAN, or they use an old port that still points to a previous address.
- Printing stops after a power outage. The printer came back with a different DHCP lease. Use a reservation or static address.
- Printer shows as Offline in Windows. Windows could not reach the port. Check reachability first. If SNMP status is enabled but the printer does not answer SNMP, Windows can mark it offline even though printing would work. Turn off SNMP status in the port settings to test this.
- Wrong port type. A port set to LPR with the wrong queue name fails, while the same printer on RAW 9100 works. Match the protocol to what the printer supports.
- 169.254.x.x on the printer. DHCP did not answer. Check the cable, switch port or Wi-Fi settings.
- Print job reaches the server but not the printer. The server's own port to the printer is broken. Test from the server, not from the client.
Cleaning up the queue
Network problems often leave jobs stuck in the queue. After you fix the path, a job can still be waiting. Clearing the Windows spooler is covered in the print spooler chapter. On Linux or macOS, CUPS can show the printers it knows and cancel pending jobs:
lpstat -p -d
cancel -aExercise
A user prints to a shared printer by IP address. It worked yesterday, but today every job sits in the queue. The printer panel shows 192.168.1.77, and the Windows port points to 192.168.1.50. What most likely happened, what command checks the connection, and what is the permanent fix?
Show answer
The printer took a new address from DHCP, so the port now points to an address the printer no longer uses. Run Test-NetConnection -ComputerName 192.168.1.77 -Port 9100 to confirm the printer answers at the new address, and the same test against 192.168.1.50 to show the old address fails. Update the port to the new address. The permanent fix is a DHCP reservation for the printer's MAC address, or a static IP outside the DHCP range.
Exercise
Which port does the Standard TCP/IP port in Windows use by default for raw printing, and which port does IPP use?
Show answer
Raw printing uses TCP 9100. IPP uses TCP 631.