Operating System - HP-UX
1833863 Members
2255 Online
110063 Solutions
New Discussion

Get ALL IP addresss of my system

 
Sung-hee Kim
Occasional Contributor

Get ALL IP addresss of my system

Hi,

I want to know how to program to get all ip addesses of my system. I don't want using ifconfig or SNMP.

If you know some function or library, let me know.

Thank you in advance,
10 REPLIES 10
Tom Geudens
Honored Contributor

Re: Get ALL IP addresss of my system

Hi,
Would
#grep "IP_ADDRESS" /etc/rc.config.d/netconf
do the trick ?

Regards,
Tom
A life ? Cool ! Where can I download one of those from ?
Michael Tully
Honored Contributor

Re: Get ALL IP addresss of my system

Getting the information from /etc/rc.config.d/netconf, may provide inaccurate information if the file has been modified. What is the problem with getting it from 'ifconfig' output?
Anyone for a Mutiny ?
Ralph Grothe
Honored Contributor

Re: Get ALL IP addresss of my system

How about parsing the output of
netstat -in
?
Mind you, if you run a cluster several IP addresseses probably will be bound to the same NICs.
Madness, thy name is system administration
Scott Van Kalken
Esteemed Contributor

Re: Get ALL IP addresss of my system

No matter which way you look at it, if your machine has a GSP and a lan console configured, you'll need to get at least one of them manually.
Sung-hee Kim
Occasional Contributor

Re: Get ALL IP addresss of my system

I don't like parsing the output. I want another way to find ip.

If there is no way, I can use "netstat -in".
Tom Geudens
Honored Contributor

Re: Get ALL IP addresss of my system

Hi,
Try
#man gethostbyaddr
#man gethostbyname
I believe there is a sample program in there too ...

Is that what you were looking for ?

Regards,
Tom
A life ? Cool ! Where can I download one of those from ?
Arockia Jegan
Trusted Contributor

Re: Get ALL IP addresss of my system

Use the following command and look at the last few lines to get your system IP addresses,

#print_manifest


Roberto Severo
Advisor

Re: Get ALL IP addresss of my system

Just complementing Arockia:

The ignite-UX must be installed, and if the command isn't in the $PATH, just type:

/opt/ignite/bin/print_manifest

-roberto
MANOJ SRIVASTAVA
Honored Contributor

Re: Get ALL IP addresss of my system

Hi

If you ahve the name resolved correclty then may be nslook up hostname will give the correct IP adress of the system


Manoj Srivastava
Lokesh Kumar
New Member

Re: Get ALL IP addresss of my system

Hi,

I guess the function that you are looking for is gethostent() which returns
struct hostent where you'll
have all the ip addresses of your system.

Look at the man page for gethostent() for more info.

-Lokesh.