Koozali.org: home of the SME Server

Local Printer via "Samba Printer Port", enumports and /listports "program"

Offline brentonv

  • ****
  • 71
  • +0/-0
hi there. i am setting up an SME 7.2 PDC which will be the DC and central print server for all remote offices over VPN and also configured for "Point and Print". this is so that we can keep a central system for all printers and drivers and hopefully manage print quotas (using CUPS). i have been experimenting with both LPRng and CUPS however both systems use the "Samba Printer Port" and this is my issue.

when a remote office connects to a printer hosted on the PDC, it creates a "Samba Printer Port" and the PDC manages the print job and you CANNOT create additional ports. this means that if the PDC is on 10.0.1.x and the printer and client are on 10.1.1.x, the print job is sent from the local network 10.1.1.x over VPN to 10.0.1.x and transported back again to the local printer on 10.1.1.x.

it would be far more efficient for the print job to go directly from the client to the printer on the local network 10.1.1.x rather than route through 10.0.1.x over VPN. i imagine that when 100 staff are printing this will destroy the network and VPN anyhow. i have looked into samba documentation and it says:

Quote

The concept of a "port" is fairly foreign to UNIX hosts. Under Windows NT/2000 print servers, a port is associated with a port monitor and generally takes the form of a local port (i.e. LPT1:, COM1:, FILE:) or a remote port (i.e. LPD Port Monitor, etc...). By default, Samba has only one port defined--"Samba Printer Port". Under Windows NT/2000, all printers must have a valid port name. If you wish to have a list of ports displayed (smbd does not use a port name for anything) other than the default "Samba Printer Port", you can define enumports command to point to a program which should generate a list of ports, one per line, to standard output. This listing will then be used in response to the level 1 and 2 EnumPorts() RPC.

Default: no enumports command

Example: enumports command = /usr/bin/listports



by creating additional ports i imagine that i could then forward print jobs to the local printer direct. i have managed to get the enumports command to funtion as a custom-template in smb.conf global variables, however i cannot find any information on how the listports "program" should be written. if has anyone had experience in writing a listports file could you please explain how it works.

i did find this on lists.samba.org however i end up with no ports at all when i create the listports "program" as suggested:

Quote

> How to use enumports command, "you can define enumports command to point
> to a program which should generate a list of ports, one per line, to
> standard output" What does that mean? The program look like what?


-----cut here------------------
#!/bin/

echo "LPT1:"
echo "LPT2:"
echo "LPT3:"

-----cut here------------------


regards,
brentonv

EDIT: i just found http://lll.lu/Presentations/LinuxDay2006/listports but same result. no ports at all. this is what i get when i run testparm:

Quote

[root@sandbox ~]# testparm  /etc/e-smith/templates-custom/etc/smb.conf/10globals
Load smb config files from /etc/e-smith/templates-custom/etc/smb.conf/10globals
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

# Global parameters
[global]
        enumports command = /home/e-smith/files/samba/netlogon/listports
[root@sandbox ~]#


and here is the contents of /home/e-smith/files/samba/netlogon/listports from http://lll.lu/Presentations/LinuxDay2006

Quote
#!/bin/sh

cat <<EOF
port1
port2
testport
xyz
EOF

can someone please test this and see if you can get ports to show. i don't know what i am doing wrong. thanks again.
« Last Edit: September 27, 2007, 05:00:00 PM by brentonv »

Offline brentonv

  • ****
  • 71
  • +0/-0
Re: Local Printer via "Samba Printer Port", enumports and /listports "program"
« Reply #1 on: September 27, 2007, 02:49:04 PM »
hey guys. i did manage to get the ports to show up.

i moved the listports "program" in smb.conf global from "enumports command = /home/e-smith/files/samba/netlogon/listports" to "enumports command = /var/scripts/listports" and now enumports successfully refers to the listports "program".

however printing still routes through the PDC which does not resolve my issue. this is confirmed by running MS "network monitor 3.1" and capturing traffic from source to destination when printing (i thoroughly recommend this program but helpfiles are minimal). my listports "program" is:

Quote
#!/bin/sh

cat <<EOF
\\10.1.1.201\print
EOF

\\10.1.1.201\print is the correct port and is selected as the printer port ("Samba Printer Port" no longer exists) however it does not seem to do anything. from my earlier post where i indicated that i had no ports, to my surprise printing still worked which seems to indicate that the "Samba Printer Port" is overiding. surely there is a way to access the local network for printing rather than over VPN.

my thoughts were that if i could get the client to connect to the print server and establish a printer (including drivers), i could then simply tick the appropriate local port to ensure that print traffic remains local. i will keep posting my progress but please help me if you can. i will test the difference between "cat <<EOF" and "echo" tomorrow and post my results eg:

Quote
#!/bin/sh

cat <<EOF
\\10.1.1.201\print
EOF
          VERSUS
Quote
#!/bin/

echo "\\10.1.1.201\print"

regards,
brentonv

EDIT: i should mention that i believe this should work in the same way that MS-TSclients map local printers. maybe "disable spoolss =" has something to do with it! where are all the samba experts? probably at samba.org; i will post this there as well. hope that helps and thanks again.
« Last Edit: September 27, 2007, 05:07:42 PM by brentonv »