Printing to Dynamic IP Addresses
With more people connecting over the internet to access our computers and networks, there is a need to print to dynamic IP Addresses. How can we configure such a printer on the HP3000? The following issues need to be addressed:
- A triggering mechanism to indicate an IP address may have changed
- A method to obtain the IP Address
- A process to modify NPCONFIG.PUB.SYS to substitute the IP Address
- [Re]start the spooler to pick up the change.
- No additional capabilities can be given to the users
- The printer can only be printing when the remote user is connected.
Each NPCONFIG printer entry has a unique comment to identify which lines contain the IP addresses to be changed. Here is the example from our setup.
999 (network_address = REMIP #Remote Printer IP
jam_recovery = false
snmp_enabled = false
pjl_supported = false)
Monitoring Batch Job
The monitor job runs as MANAGER.SYS and polls for a user to logon (the trigger) and changes the NPCONFIG entry appropriately.
Changes made to NPCONFIG.PUB.SYS take effect with a STOPSPOOL and STARTSPOOL. The monitor job uses ALLOWME from the CSL to grant these console commands. An alternative to ALLOWME is to globally ALLOW the STARTSPOOL and STOPSPOOL commands. Each has its pros and cons. My preference is the ALLOWME utility.
Quad is used to make changes to NPCONFIG.
It sets the OUTFENCE to 14 for the printer when it “turns off”. This allows spoolfiles to be queued and will print when the connection is restored. The present spoolfile will complete if the connection remains active when the last user logs off.
!while 1 = 1
! pause job=test.account;notexist
! comment showconn to extract ip address
! purge JOBNUMF#>$null
! showjob;job=test.account > JOBNUMF1
! save JOBNUMF1
! GREP.HPBIN.SYS "-i TEST.ACCOUNT ./JOBNUMF1" > JOBNUMF2
! save JOBNUMF2
! CUT.HPBIN.SYS "-c1-7 ./JOBNUMF2" > JOBNUMF3
! save JOBNUMF3
! input JOBNUMBER < JOBNUMF3
! showconn !JOBNUMBER > JOBNUMF4
! save JOBNUMF4
! print JOBNUMF4;START=5;END=5 > JOBNUMF5
! save JOBNUMF5
! CUT.HPBIN.SYS "-c2-16 ./JOBNUMF5" > JOBNUMF6
! save JOBNUMF6
! input IPADDR < JOBNUMF6
! comment modify npconfig
! quad "T NPCONFIG;C:REMIP:,:!IPADDR:,A I:Remote Printer IP:;K;E"
! if oldip <> ipaddr then
! stopspool !printer_ldev
! pause 1
! startspool !printer_ldev
! outfence 7;ldev=!printer_ldev
! pause job=test.account;exist
! setvar oldip, "!ipaddr"
! outfence 14;LDEV=!printer_ldev
! comment quad "T NPCONFIG;C:!IPADDR:,:REMIP:,A I:Remote Printer IP:;K;E"
More Complicated Setups
The sample job listed above works very well for a one-to-one correspondence between a user and a printer. But it can be adapted to handle a wide variety of situations. Other environments that this can be applied to as is or with alterations are:
- Users connecting to your network via a Remote Access Server (Dialup PPP)
- Users connecting directly over the Internet
- Users connecting to your network via a Virtual Private Network (VPN) connection
- Multiple users sharing a single IP address using a firewall and Network Address Translation (NAT). This situation in particular means the script must be modified to look for different logon names as the trigger.
Remote users running a firewall/NAT can use JetDirect print servers. All of the remote users appear to the system as a single IP address that’s what Network Address Translation does. The Firewall is configured to forward incoming packets on port 9100 to the print server.
For remote users who are not running NAT, their workstation holds the only IP address the system can talk to. The workstation must also act as the print server in this environment. These users can load printer server software such as from Brooks Internet Software (http://www.brooksnet.com). This software enables a PC to emulate a JetDirect print server and route the output to any local printer it has access to.
The job outlined above will take a little CPU on your system. In a test it took about 4 minutes of CPU per day on an HP3000 928 (32 minutes over 8 days).
Printing to a dynamic IP Address is possible with the simple scripting techniques shown here. This example demonstrates a job monitoring user logons. When appropriate changes are made to the NPCONFIG.PUB.SYS file and the spooler is restarted. Spoolfiles can be created and queued until the printer comes online by setting the OUTFENCE high while the connection is offline. CPU consumption to manage the environment is minimal.