l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2004 Sep 26 19:12

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Getting next-closest hostname for an IP address
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Getting next-closest hostname for an IP address

With shell scripting, it should be possible:
$ export BEFORE=`traceroute passwall.com 2>&1 | tail --lines=2 | head
--lines=1 | cut -d' ' -f2-3 | tr -d ' '`
$ echo $BEFORE

You could combine the cut/tr into a single sed for great justice.

Bill Kendrick said:
> I have a problem which I'm hoping one of the networking gurus out here can
> help me with.
> I'm trying to determine the hostname of a system that's one step closer to
> me than the IP address I have in my hand.  The IP address I have is
> temporary
> and unnamed (FYI, it's a cellphone), so "host", "nslookup" and "resolveip"
> all fail.
> To explain graphically:
>   [My server] -> ... -> ... -> [Wireless provider] -> [Cellphone]
> I have the IP address of the cellphone, but it has no hostname.
> So I'm hoping to be able to get the hostname of some machine in the
> wireless provider's network, so I can determine who the carrier is.
> If I do a "traceroute" or "mtr" on the IP address, for example, I can see
> that the last few hops are "###.sub-##-###-##.myvzw.com".  From that
> I can determine, "oh, 'myvzw.com'... must be Verizon."
> But is there a tool I can use that can get this information?
> (I need it fairly quickly, and in a format easy for pulling in via a
> script -- I need to get this information _while_ responding to the phone
> when it connects to my server.  It would be simiar to "gethostbyaddr($IP)"
> or calling `host $IP` in PHP, except it'd get the name of the next hop
> up.)
> Thanks!
> -bill!
> bill@newbreedsoftware.com                            New Breed Software
> http://www.newbreedsoftware.com/       Tux Paint 0.9.14 -- Coming soon!
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.