Get ip of client, not hostname

Hello i'm trying to get the ip of a telnet session.

With who -u I get the hostname of the user connecting to my server, because it checks the reverse DNS. But I only want the ip.

Versions: HP-UX HP Release B.11.31
Who command: Hewlett-Packard Company - 4 - HP-UX 11i Version 3 Feb 2007

Do you know another command? Or how block the use of the reverse DNS?

Thank you!

I think that the reverse DNS is looked up at login time and recorded. You would just need to look up the DNS name to get the IP again though.

You might use one of:- dig, host, nslookup or something else, even ping might do it for you.

I hope that this helps,
Robin

There is the HP-UX specific getip command

who -u | while read line
do
  ip=$(getip "${line##* }")
  echo "$line  $ip"
done
1 Like