Operating System - HP-UX
1820260 Members
2939 Online
109622 Solutions
New Discussion юеВ

How to obtain remote ip address without using DNS?

 
Fabricio_5
Occasional Contributor

How to obtain remote ip address without using DNS?

How do I obtain the remote ip address of a computer connected via telnet using the 23 port without using hostname and any dns service. Imaging that DNS and hostname does not exist, how can I do that?
6 REPLIES 6
RAC_1
Honored Contributor

Re: How to obtain remote ip address without using DNS?

who -u (Check the last column)
arp -a

Hope this helps.

Anil
There is no substitute to HARDWORK
Muthukumar_5
Honored Contributor

Re: How to obtain remote ip address without using DNS?

You can get the specific login informations with who command as,

getip `who -mu | awk '{ print $8 }'`

You can use netstat -na | grep 'localserverip.23'
will give all ip-address login in the system.

You can also use last command to get login informations there with ip-address.

HTH.
Easy to suggest when don't know about the problem!
Fabricio_5
Occasional Contributor

Re: How to obtain remote ip address without using DNS?

The arp -a command gives me lots of hostnames and ip addresses and the who -u command gives me the hostname.

I want to print only the remote ip address in the screen.
Sanjay_6
Honored Contributor

Re: How to obtain remote ip address without using DNS?

hi,

Try "who -R" which gives the ip address. It gives a list.

Hope this helps.

regds
rick jones
Honored Contributor

Re: How to obtain remote ip address without using DNS?

The manpage for arp describes the '-n' option that suppresses host and port number lookups.

Just as the -n option in netstat does.
there is no rest for the wicked yet the virtuous have no pillows
Geoff Wild
Honored Contributor

Re: How to obtain remote ip address without using DNS?

I'd say that to answer your question - this is impossible.

Basically - everything mentioned uses the DNS resovler routines to provide the result.

who uses gethostname and gethostbyaddr...

Right from the who man page:

-R Displays the user's host name. If the user is
logged in on a tty, who displays the string
returned from gethostname() (see gethostname(2)).
If the user is not logged in on a tty and the host
name stored in the /etc/utmp or named file has not
been truncated when stored (meaning that the
entire host name was stored with no loss of
information), it is displayed as it was stored.
Otherwise, the gethostbyaddr() function is called
with the internet address of the host (see
gethostent(3N)). The host name returned by
gethostbyaddr() is displayed unless it returns an
error, in which case the truncated host name is
displayed.

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.