1833788 Members
2076 Online
110063 Solutions
New Discussion

Printer IP address

 
SOLVED
Go to solution
Michael Treacy
Advisor

Printer IP address

I have many printers installed on a HP/UX 11 machine that are referenced by name. They are setup locally in the LP Spooler as network printers. They all work, however I need to know their IP addresses. There is not a PERIPH variable in their respective /etc/lp/interface/printer_name files.
Any ideas where the IP Addresses can be found ?
16 REPLIES 16
Mei Jiao
Respected Contributor

Re: Printer IP address

Try this:
# nslookup

If you have configured DNS and /etc/nsswitch.conf file also has 'dns' on the 'hosts' entry, your DNS should be able to resolve the IP address.
Michael Treacy
Advisor

Re: Printer IP address

nslookup can't resolve the name.
They aren't in the HOSTS file.
The printer names are defined locally and wouldn't be found on other servers.
Mei Jiao
Respected Contributor
Solution

Re: Printer IP address

The PERIPH variable should be in the /etc/lp/interface/ file or /usr/spool/lp/interface/ file which contains the IP address.

Try this again?
# cd /usr/spool/lp/interface/
# grep PERIPH

What output do you get?
Steve Steel
Honored Contributor

Re: Printer IP address

Hi

same directory as hppi

hpnpadmin -v printername

gives a verbose description including the IP

hpnpadmin -v bprn122
bprn122 is a network printer

Printer State : ready to print


topaz is allowed access to bprn122

Fail (1)

Card IP Address : bprn122.bel.hp.com (16.56.163.9)
Network Mask : 255.255.248.0
Default Gateway : ??? (16.56.160.1)
Idle Timeout : 270 seconds

Uptime : 15 days, 20:29:32
Time Since Reconfig : 15 days, 20:29:16
Reconfig By : not specified
Connections Accepted: 697
Connections Denied : 0 (not on access list)
Connections Aborted : 1
Last Host : broprn-n2.bro.cpqcorp.net (16.183.16.49)



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Jose Mosquera
Honored Contributor

Re: Printer IP address

Hi,

Just making a ping at the printer name:
#ping

Generally, for specific application use; printers are defined in /etc/hosts file. While for global the are defined in a DNS machine. The best way to determine this possibility is using the command nslookup:
#nslookup

The output will indicate you if the /etc/hosts file or DNS is used.

Rgds.
Muthukumar_5
Honored Contributor

Re: Printer IP address

Change hosts: entry in /etc/nsswitch.conf file as,

hosts: DNS FILES

Check is there a nameserver and domain entry in /etc/resolve.conf,

domain test.com
nameserver x.x.x.x

nslookup printer-name
It will give all informations of hostname,ip-address and aliases

All hostname to address resolvation will be based on hosts: entry on /etc/nsswitch.conf file.
Easy to suggest when don't know about the problem!
Mei Jiao
Respected Contributor

Re: Printer IP address

I've tried on 'hpnpadmin -v ' command. Fresh to me, it produces a lot of information.

But I think it still need the or you can put the for the command.

Maybe you try this again?
# cd /usr/spool/lp/interface/
# grep PERIPH
Geoff Wild
Honored Contributor

Re: Printer IP address

hpnpadmin -v XXXX |grep Address

where XXXX is the printer name.

If you want all:

for i in `ls /etc/lp/interface | grep -v model.orig `
do
echo $i
hpnpadmin -v $i |grep Address
done

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Steve Steel
Honored Contributor

Re: Printer IP address

Hi


Try

1.lpstat -v|grep null|cut -f 3 -d" "|sort -u|while read line
2. do
3. line1=$(echo $line|sed -e 's/_.*$//g')
4. echo $line1":"$(nslookup $line1 2>/dev/null)|grep answer
5. done

lpstat -v lists printers

/dev/null is normally network

remove _ to get real name

Wont work if name not based on internet name



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Steve Steel
Honored Contributor

Re: Printer IP address

Hi

Try this

1 ls -1 /etc/lp/interface/model.orig|while read line
2 do
3 if ishpnp $line
4 then
5 echo $line is a network printer
6 nslookup $line 2>/dev/null|grep Address
7 line1=$(echo $line|sed -e 's/_.*$//')
8 nslookup $line1 2>/dev/null|grep Address
9 else
10 echo " "
11 fi
12 done


steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Michael Treacy
Advisor

Re: Printer IP address

Thanks for all the ideas...

The hpnpadmin commands give SNMP errors like this:
hpnpadmin -v mmfin05
mmfin05: Unknown printer
: Error sending SNMP request.
*** Can't find the session!

nslookup gives
device for mmfin05: /dev/null
Cheryl Griffin
Honored Contributor

Re: Printer IP address

As a last resort, the ip also prints on the test page from each printer.
"Downtime is a Crime."
Michael Treacy
Advisor

Re: Printer IP address

I tried again this morning...
And the PERIPH variable is found in the /etc/lp/interface/priner_name files.

Thanks to ALL !
Steve Steel
Honored Contributor

Re: Printer IP address

Hi

This is the simplest of scripts.5 lines

1. find . -type f|xargs grep ^PERIPH=|while read line
2. do
3. name=$(echo $line|cut -f2 -d"=")
4. echo $line"|"$(nslookup $name 2>/dev/null|grep Address)
5. done

It will check for network setup printers and give the IP if known



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Steve Steel
Honored Contributor

Re: Printer IP address

Hi

This is the simplest of scripts.5 lines

run it on directory /etc/lp/interface

1. find . -type f|xargs grep ^PERIPH=|while read line
2. do
3. name=$(echo $line|cut -f2 -d"=")
4. echo $line"|"$(nslookup $name 2>/dev/null|grep Address)
5. done

It will check for network setup printers and give the IP if known



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Michael Treacy
Advisor

Re: Printer IP address

Thanks Steve..

That is exactly what I needed....
I very much appreciate your ideas and scripts.