Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Changing IPs for all printers

SOLVED
Go to solution
Marty Metras
Super Advisor

Changing IPs for all printers

We have to go onto the Corp backbone. As part of this we are changing our whole IP scheme.
One of my parts of this is all the JetDirect printers on the HP server. Is there a easier way to resign the printer config to a new IP. My first thought was just drop the printer and recreate it. Not hard to do. It seams when you are doint a mess of then there always is some thing the gets messed up.
I thought there might be a way to just find the config file and change the IP.
Each printer is assigned a static IP. I have and old and new list of IPs. I figure it might take about the same time recreating them as changing the IP.
How would one go about just changing the IP for the printer?
Marty
Oh, there is only 28 printers I need to change. All are HP printers on JetDirect serves except maybe 5-6 that different.
The only thing that always remain the same are the changes.
3 REPLIES
Pete Randall
Outstanding Contributor

Re: Changing IPs for all printers

Marty,

I would use your list of new IPs to create a little script. Something like this:

#!/bin/ksh# shut down the print spooler
#############################
/usr/lib/lpshut
#############################
# for each printer listed , ...
#############################
for PRNTR in `cat /nfs/yukon/apps/hols/bin/ts/printer_list`
do
case $PRNTR in

crlzr2_nf) IP=130.1.1.74
;;
crlzr3_nf) IP=130.1.1.72
;;
registry2) IP=130.1.7.73
;;
dairyserv1) IP=130.1.6.73
;;
dhscolor) IP=130.1.6.72
;;
sysprog1) IP=130.1.6.71
;;
billsvc) IP=130.1.5.71
esac
removequeue -f -q $PRNTR
addqueue -h $IP -q $PRNTR -b off
done
#############################
# after the last printer is added, restart the spooler
#############################
/usr/lib/lpsched


Pete

Pete
John Jimenez
Super Advisor
Solution

Re: Changing IPs for all printers

go to
/var/spool/lp/interface and modify. If you have DNS you can set this printers up by host name instead of IP, so you do not have to worry about IP addresses.

Hustle Makes things happen
Bill Hassell
Honored Contributor

Re: Changing IPs for all printers

The /etc/lp/interface directory contains the base printer script. For HP JetDirect connections, the scripts are all the same except for the PERIPH= line. Unless your IT department makes a special point to setup printer hostnames, the IP address is much more reliable -- and in your case, moving to a different corporation's network probably means no DNS support for the printers.

You are correct though, remove and add will be easier than editing all those files. Make a list of the printer names (more accurately, the print queue names), then using vi, create a file with removequeue and addqueue. The only individual step would be to insert the IP new address. Something like this:

prn1
prn2
prn3
...
prn28

-----insert PATH to shorten the lines
PATH=/opt/hpnpl/bin
removequeue -q prn1
removequeue -q prn2
removequeue -q prn2
...
removequeue -q prn28

then run this script to delete the printers.

-----same file, replace with addqueue
addqueue -q prn1 -h 12.34.56.78
addqueue -q prn2 -h 12.34.56.77
addqueue -q prn3 -h 12.34.56.76
...
addqueue -q prn28 -h 12.34.56.48

And now all the printers are back with new IP addresses.


Bill Hassell, sysadmin