Operating System - HP-UX
1825711 Members
3061 Online
109686 Solutions
New Discussion

check my ip address instead of my dns name

 
SOLVED
Go to solution
Moises Kaplan
Occasional Advisor

check my ip address instead of my dns name

I would like to know the command to check my ip address.
When I use who -u (or who -R) I get my dns name instead.

thanks, mk
15 REPLIES 15
A. Clay Stephenson
Acclaimed Contributor

Re: check my ip address instead of my dns name

How about
getip $(who -u | awk '{print $NF}')
?
If it ain't broke, I can fix that.
Moises Kaplan
Occasional Advisor

Re: check my ip address instead of my dns name

thanls a.clay,

but I get an error message:
Usage: getip host
A. Clay Stephenson
Acclaimed Contributor

Re: check my ip address instead of my dns name

Then I suspect that you made a typing booboo because it works for me.

What is your EXACT output of who -u?
If it ain't broke, I can fix that.
Moises Kaplan
Occasional Advisor

Re: check my ip address instead of my dns name

I just copy and pasted.

this is the line for who am i -u

moises pts/tk Sep 18 17:55 . 8480 mn_064.national-lumber.com

thanks
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: check my ip address instead of my dns name

OK, do this for me:

getip mn_064.national-lumber.com

Does that work?


Now try,
who -u | awk '{print $NF}'

Does that output mn_064.national-lumber.com?

The problem is probably a result of the illegal "_" character in your hostname. If you play by the DNS rules, "_"'s are not allowed.

If it ain't broke, I can fix that.
Moises Kaplan
Occasional Advisor

Re: check my ip address instead of my dns name

it didn't work

any other sugestion?
Moises Kaplan
Occasional Advisor

Re: check my ip address instead of my dns name

sorry, I forgot to tell you, I'm at a pc w/a fix IP address. I'm not inquiring about the host, but about my own IP address

thanks, mk
Steven Schweda
Honored Contributor

Re: check my ip address instead of my dns name

> getip $(who -u | awk '{print $NF}')

dy # getip $(who -u | awk '{print $NF}')
Usage: getip host

dy # who -u
root pts/0 Sep 18 17:03 . 1180 alp-l.antinode.org
root console Sep 18 17:04 0:02 2146 system console

dy # who -mu
root pts/0 Sep 18 17:03 . 1180 alp-l.antinode.org

Or, "who am i -u".

dy # getip $(who -mu | awk '{print $NF}')
10.0.0.9


> it didn't work
>
> any other sugestion?

Yes. Say exactly what you did, and,
exactly, what happened when you did it.
Saying "it didn't work" is about as useless
as saying nothing.
MarkSyder
Honored Contributor

Re: check my ip address instead of my dns name

While logged in to your unix box type:

ping `hostname`

where ` is the key in the top left corner of the keyboard. The result will display the ip address.

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Dennis Handly
Acclaimed Contributor

Re: check my ip address instead of my dns name

>Mark: where ` is the key in the top left corner of the keyboard.

If you used the following you wouldn't have to explain it: :-)
$ ping $(hostname)
Dennis Handly
Acclaimed Contributor

Re: check my ip address instead of my dns name

Of course you can save even more steps by:
$ nslookup $(hostname)
rmueller58
Valued Contributor

Re: check my ip address instead of my dns name

look at the last column.
who am i -u

Sp4admin
Trusted Contributor

Re: check my ip address instead of my dns name

Hello,

I agree with Dennis, why not just do a nslookup on the hostname. You also can check the /etc/rc.config.d/netconf file or the /etc/hosts.

sp,
Moises Kaplan
Occasional Advisor

Re: check my ip address instead of my dns name

thanks guys, I'm all set

mk
Moises Kaplan
Occasional Advisor

Re: check my ip address instead of my dns name

I got it, thanks, moises kaplan