Printer Sharing

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 11:43, 24 January 2007 (edit)
Sbn (Talk | contribs)

← Previous diff
Current revision (20:08, 29 December 2017) (edit) (undo)
Ian5142 (Talk | contribs)
(Removed - Installing on Asus WL500G Deluxe, with DD-WRT v24-sp2)
 
(48 intermediate revisions not shown.)
Line 1: Line 1:
-Install [[ USB | USB support]] (usb_storage, sd_mod etc. can be left out if no need for external storage).+{{languages|Printer_Sharing}}
 + 
 +DD-WRT allows for clientless printer sharing making it easy to install printers directly into the router without the need for a seperate computer. You must have installed [[USB storage|USB support]] (usb_storage, sd_mod etc. can be left out if no need for external storage).
 + 
 +Some of the information below is outdated. I made a guide for how to get USB printing working on the Asus WL-520gU. It should also apply to other routers with USB. [http://wl520gu.googlepages.com/ http://wl520gu.googlepages.com/]
 + 
 +The following must be done via telnet or SSH:
==Printer driver== ==Printer driver==
 +
 +NOTE: You must first enable jffs through the GUI before completing the following steps.
 +
 + Go to the "Administration" tab, then to the "Management" sub-tab. Select 'Enable' for "JFFS2" under "JFFS2
 + Support", and select 'Enable' for "Clean JFFS2". Click "Apply Settings"
Install printer driver: Install printer driver:
- ipkg install kmod-usb-printer+ ipkg -force-depends install kmod-usb-printer
Edit '''/jffs/etc/config/usb.startup''' and add Edit '''/jffs/etc/config/usb.startup''' and add
Line 23: Line 34:
usblp0 means that the found printer is accessible at '''/dev/usb/lp0''' etc. usblp0 means that the found printer is accessible at '''/dev/usb/lp0''' etc.
-==Print server==+Note: The 'USB Support' link above refers to installing several modules. On my WRT350N, I had to install these additional modules (usb-uhci.o and usb-ohci.o) to get my router to detect that my printer was plugged in.
-Now Install printserver daemon:+comments from wmd1942:
- ipkg install p910nd+I found the command "insmod /jffs/lib/modules/2.4.30/printer.o" is unnecessary if you have Core USB Support, USB 2.0 Support and USB Printer Support enabled in the 'Services' section of the router web page.
-Edit '''/jffs/etc/config/usb.startup''' and add  
- #brother laser 
- /jffs/usr/sbin/p910nd -b -f /dev/usb/lp0 0 
- #canon inkjet 
- /jffs/usr/sbin/p910nd -b -f /dev/usb/lp1 1 
-(correct the above to match your setup) 
--b means bidirectional, -f specifices device name, and the last number can be 0,1 or 2, making the print server listen at port 9100, 9101 and 9102 respectively. 
-Reboot your router+==Workstation setup==
-Now, you router works as a print server with RAW printing over TCP/IP+'''CUPS Web Interface
 +* Make sure that the CUPS service is up and running
 +* Open http://localhost:631 in you web browser, assuming that you are running the CUPS server locally.
 +* Click the 'Administration' tab
 +* Click the 'Add printer' button under 'Printers'
 +* Choose 'AppSocket/HP JetDirect ' and click 'Continue'
 +* Enter 'socket://HOSTNAME:9100' where HOSTNAME is the ip address of you router (normally 192.168.1.1). 9100 is for the first printer, 9101 for the second etc. Click 'Continue'
 +* Go on with the printer wizard to select brand, model and settings as you would do for a local printer. As a general rule, PPD files are provided by printer driver packages and put in /usr/share/cups/model.
-==Workstation setup==+'''Ubuntu Linux
 +* Go to System, Administration, Printing.
 +* Click New Printer
 +* Choose AppSocket/HP JetDirect
 +* Hostname: IP address of the wireless printer (normally 192.168.1.1)
 +* Port: 9100 for first printer, 9101 for second printer, etc
 +* Click Forward and go on with the printer wizard to select brand, model and settings as you would do for a local printer
-Windows XP:+'''Windows XP
-Find your printer in Control Panel - Printers etc. and open the properties page for it. Select the Ports tab.+* Find your printer in Control Panel - Printers etc. and open the properties page for it.
-Click Add Port and choose Standard TCP/IP printer port and click New Port+* Select the Ports tab.
-Enter you router's IP address (normally 192.168.1.1) and click Next+* Click Add Port and choose Standard TCP/IP printer port and click New Port
-Set Device type to custom and click settings.+* Enter you router's IP address (normally 192.168.1.1) and click Next
-Make sure RAW is selected and specify the necessary port number (normally 9100) and click OK+* Set Device type to custom and click settings.
-Click Next and Finish and Close+* Make sure RAW is selected and specify the necessary port number (normally 9100, 9101 for second printer, etc) and click OK
-Make sure the newly created port is selected for your printer and click OK+* Click Next and Finish and Close
 +* Make sure the newly created port is selected for your printer and click OK
-That's it+'''Mac OS X 10.5 (Leopard)
 +* Open System Preferences
 +* Open Print & Fax
 +* Click the + button below the list of installed printers
 +* Select the toolbar button called 'IP'
 +* Set protocol to: HP Jetdirect - Socket
 +* Enter the address of your router followed by : and the port - ie. normally 192.168.1.1:9100
 +* Leave 'Queue' blank
 +* Set a friendly name for your printer (whatever you like)
 +* And a friendly location (again, up to you)
 +* Print Using: choose 'Select a driver to use'
 +* A list will pop up of all installed printer drivers - choose the one that works for you (see Note below)
 +* Add your printer
-==Printing from WAN==+Note (Mac only): the driver must be compatible with the CUPS printing system, which is one of the two printing systems included in OS X. Certain printers e.g. Canon Pixma series and Epson Inkjet include OSX drivers which do not use CUPS. You may find compatible printer drivers from [http://gimp-print.sourceforge.net/MacOSX.php3 Gutenprint (free)] or [http://www.printfab.net/ PrintFab ($)]. OS X Leopard appears to include certain Gutenprint drivers, but the quality may vary and it may be worth checking their website for updated versions, or try PrintFab.
 +==Printing from WAN==
If you want to be able to print from the WAN side of your router do the following: If you want to be able to print from the WAN side of your router do the following:
Line 71: Line 102:
NOTE: This is not recommended if your WAN is directly accessible from internet, but useful at private subnets of companies, colleges etc. NOTE: This is not recommended if your WAN is directly accessible from internet, but useful at private subnets of companies, colleges etc.
-[[Category:advanced HOWTO]] 
-[[Category:English documentation]]+ 
 + 
 +== Notes for K26 ==
 + 
 +With the new kernel 2.6 the kernel doesn't create the device file /dev/usb/lp0 anymore. You have to do that manually once. Just issue
 + mknod -m 660 /dev/usb/lp0 c 180 0
 +once and everything is going to work. This should probably be done before starting the p910nd server.
 + 
 +Note from another user: I had to add this mknod command to /jffs/etc/config/usb.startup.
 + 
 +== Notes for Windows ==
 + 
 +Even if you follow the above steps under Windows XP for linking your Windows PC to your router you might run into some Windows driver issues. If after the link, you send the test page and the printer beeps to indicate it received a job but then doesn't print then you'll need to define the printer settings again. You can also look at the log files which would indicate "print job sent" "job completed"
 + 
 +Go to Devices and Printers and right click Properties on the printer you have set up.
 +Under the Advanced Tab check that the Drivers and Drivers are set up correctly.
 + 
 +Sometimes Windows will fail to set these up properly even if you've indicated the required settings previously.
 + 
 +[[Category:Applications]]
 +[[Category:Advanced tutorials]]

Current revision


DD-WRT allows for clientless printer sharing making it easy to install printers directly into the router without the need for a seperate computer. You must have installed USB support (usb_storage, sd_mod etc. can be left out if no need for external storage).

Some of the information below is outdated. I made a guide for how to get USB printing working on the Asus WL-520gU. It should also apply to other routers with USB. http://wl520gu.googlepages.com/

The following must be done via telnet or SSH:

Contents

[edit] Printer driver

NOTE: You must first enable jffs through the GUI before completing the following steps.

 Go to the "Administration" tab, then to the "Management" sub-tab. Select 'Enable' for "JFFS2" under "JFFS2
 Support", and select 'Enable' for "Clean JFFS2". Click "Apply Settings"

Install printer driver:

 ipkg -force-depends install kmod-usb-printer

Edit /jffs/etc/config/usb.startup and add

 insmod /jffs/lib/modules/2.4.30/printer.o

Connect printers and reboot your router

See if any printers have been found:

 dmesg | grep usb

It should show something like this (I have 2 printers connected)

 <6>printer.c: usblp0: USB Bidirectional printer dev 5 if 0 alt 0 proto 2 vid 0x04F9 pid 0x000D
 <6>printer.c: usblp1: USB Bidirectional printer dev 6 if 0 alt 0 proto 2 vid 0x04A9 pid 0x108C

usblp0 means that the found printer is accessible at /dev/usb/lp0 etc.

Note: The 'USB Support' link above refers to installing several modules. On my WRT350N, I had to install these additional modules (usb-uhci.o and usb-ohci.o) to get my router to detect that my printer was plugged in.

comments from wmd1942:

I found the command "insmod /jffs/lib/modules/2.4.30/printer.o" is unnecessary if you have Core USB Support, USB 2.0 Support and USB Printer Support enabled in the 'Services' section of the router web page.



[edit] Workstation setup

CUPS Web Interface

  • Make sure that the CUPS service is up and running
  • Open http://localhost:631 in you web browser, assuming that you are running the CUPS server locally.
  • Click the 'Administration' tab
  • Click the 'Add printer' button under 'Printers'
  • Choose 'AppSocket/HP JetDirect ' and click 'Continue'
  • Enter 'socket://HOSTNAME:9100' where HOSTNAME is the ip address of you router (normally 192.168.1.1). 9100 is for the first printer, 9101 for the second etc. Click 'Continue'
  • Go on with the printer wizard to select brand, model and settings as you would do for a local printer. As a general rule, PPD files are provided by printer driver packages and put in /usr/share/cups/model.

Ubuntu Linux

  • Go to System, Administration, Printing.
  • Click New Printer
  • Choose AppSocket/HP JetDirect
  • Hostname: IP address of the wireless printer (normally 192.168.1.1)
  • Port: 9100 for first printer, 9101 for second printer, etc
  • Click Forward and go on with the printer wizard to select brand, model and settings as you would do for a local printer

Windows XP

  • Find your printer in Control Panel - Printers etc. and open the properties page for it.
  • Select the Ports tab.
  • Click Add Port and choose Standard TCP/IP printer port and click New Port
  • Enter you router's IP address (normally 192.168.1.1) and click Next
  • Set Device type to custom and click settings.
  • Make sure RAW is selected and specify the necessary port number (normally 9100, 9101 for second printer, etc) and click OK
  • Click Next and Finish and Close
  • Make sure the newly created port is selected for your printer and click OK

Mac OS X 10.5 (Leopard)

  • Open System Preferences
  • Open Print & Fax
  • Click the + button below the list of installed printers
  • Select the toolbar button called 'IP'
  • Set protocol to: HP Jetdirect - Socket
  • Enter the address of your router followed by : and the port - ie. normally 192.168.1.1:9100
  • Leave 'Queue' blank
  • Set a friendly name for your printer (whatever you like)
  • And a friendly location (again, up to you)
  • Print Using: choose 'Select a driver to use'
  • A list will pop up of all installed printer drivers - choose the one that works for you (see Note below)
  • Add your printer

Note (Mac only): the driver must be compatible with the CUPS printing system, which is one of the two printing systems included in OS X. Certain printers e.g. Canon Pixma series and Epson Inkjet include OSX drivers which do not use CUPS. You may find compatible printer drivers from Gutenprint (free) or PrintFab ($). OS X Leopard appears to include certain Gutenprint drivers, but the quality may vary and it may be worth checking their website for updated versions, or try PrintFab.

[edit] Printing from WAN

If you want to be able to print from the WAN side of your router do the following:

In the web interface go to Administration - Commands and hit the "Command shell" field and type in

 /usr/sbin/iptables -I INPUT 1 -p tcp --dport 9100:9102 -j logaccept

And click Save Firewall

Your router reboots and you can now print from WAN side

NOTE: This is not recommended if your WAN is directly accessible from internet, but useful at private subnets of companies, colleges etc.



[edit] Notes for K26

With the new kernel 2.6 the kernel doesn't create the device file /dev/usb/lp0 anymore. You have to do that manually once. Just issue

mknod -m 660 /dev/usb/lp0 c 180 0

once and everything is going to work. This should probably be done before starting the p910nd server.

Note from another user: I had to add this mknod command to /jffs/etc/config/usb.startup.

[edit] Notes for Windows

Even if you follow the above steps under Windows XP for linking your Windows PC to your router you might run into some Windows driver issues. If after the link, you send the test page and the printer beeps to indicate it received a job but then doesn't print then you'll need to define the printer settings again. You can also look at the log files which would indicate "print job sent" "job completed"

Go to Devices and Printers and right click Properties on the printer you have set up. Under the Advanced Tab check that the Drivers and Drivers are set up correctly.

Sometimes Windows will fail to set these up properly even if you've indicated the required settings previously.