Go Back   Velocity Reviews > Newsgroups > Java
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Java - Please help: How to get the alias hostname ??

 
Thread Tools Search this Thread
Old 04-01-2006, 03:10 PM   #1
Default Please help: How to get the alias hostname ??


I don't know how to get all the alias hostname of an IP address. I have
looked through the net but got no answer.
Could somebody help me?? It's very urgent and important to me!!

Thanks!



tongyizhou@gmail.com
  Reply With Quote
Old 04-01-2006, 03:31 PM   #2
James McGill
 
Posts: n/a
Default Re: Please help: How to get the alias hostname ??

On Sat, 2006-04-01 at 07:10 -0800, wrote:
> I don't know how to get all the alias hostname of an IP address. I have
> looked through the net but got no answer.
> Could somebody help me?? It's very urgent and important to me!!


You can never know all possible aliases. How would your routine ever
know I call 127.0.0.1 "lo" "localhost" and "zero"?

Ok, but seriously, you can do a reverse DNS lookup and then do a forward
lookup and collect CNAME records.

Why do you need to do this?

  Reply With Quote
Old 04-01-2006, 03:56 PM   #3
tongyizhou@gmail.com
 
Posts: n/a
Default Re: Please help: How to get the alias hostname ??

Well, it might sounds funny.
I am just a Chinese student, and that's just a function I must
implement in my homework. Due to the requirements I must print out
all the aliases hostname and the IP addresses of the destnation URL. It
just a funny meaningless requirement right ?^_^? I just have no choice.

I will be very appreciate if U can help me out T_T

  Reply With Quote
Old 04-01-2006, 05:03 PM   #4
James McGill
 
Posts: n/a
Default Re: Please help: How to get the alias hostname ??

On Sat, 2006-04-01 at 07:56 -0800, wrote:
> Due to the requirements I must print out
> all the aliases hostname and the IP addresses of the destnation URL.


Well, getting the IP address is simple enough. For the aliases I would
do a dns lookup for CNAME records, and then pick the CNAMEs that point
to the IP address that the original hostname resolves to. But I might
be misunderstanding the project.

  Reply With Quote
Old 04-01-2006, 05:25 PM   #5
Ronny Schuetz
 
Posts: n/a
Default Re: Please help: How to get the alias hostname ??

Hi,

> Ok, but seriously, you can do a reverse DNS lookup and then do a forward
> lookup and collect CNAME records.


Might be a dumb question, but how exactly are you going to collect the
CNAME records? I thought it is not possible to look them up based on the
primary name of the machine or its IP address only.

Ronny
  Reply With Quote
Old 04-01-2006, 06:01 PM   #6
Roedy Green
 
Posts: n/a
Default Re: Please help: How to get the alias hostname ??

On 1 Apr 2006 07:10:40 -0800, wrote, quoted or
indirectly quoted someone who said :

>I don't know how to get all the alias hostname of an IP address. I have
>looked through the net but got no answer.


see http://mindprod.com/jgloss/ip.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
  Reply With Quote
Old 04-01-2006, 08:01 PM   #7
James McGill
 
Posts: n/a
Default Re: Please help: How to get the alias hostname ??

On Sat, 2006-04-01 at 19:25 +0200, Ronny Schuetz wrote:
>
> Might be a dumb question, but how exactly are you going to collect the
> CNAME records? I thought it is not possible to look them up based on
> the
> primary name of the machine or its IP address only.
>


It's not necessarily possible! There are many cases where it's not
possible at all. But in the nice cases, especially those where you have
some information about the remote system's DNS, you could.

The way the OP worded the assignment, it sounds like a case of a
clueless teacher sharing his wealth of ignorance with a new
generation.

In the real world, if you've already got a connection, you no longer
care about DNS. It doesn't matter how you addressed the host, once
you've reached it. Maybe there are situations, e.g., security related,
where you want a reverse-lookup to some canonical resolution, but in the
general case, since the mapping is arbitrary and can be private, there's
no really good way to do what the OP wants to do. I would be willing to
give an ear to someone who thinks there's a scenario where this is
necessary, or even workable.

You want *all* the aliases of a host? I doubt your program is able to
discern that I call my workstation "broken piece of crap", or more to
the point, that I have private DNS in my lab for naming hosts that have
totally different names to the public.



  Reply With Quote
Old 04-01-2006, 09:44 PM   #8
Ronny Schuetz
 
Posts: n/a
Default Re: Please help: How to get the alias hostname ??

The question was not really related to the OPs question. I was looking
for a general way to get all _public_ aliases a while ago to check X.509
certificates received during SSL handshakes and ran into this issue. Was
just wondering cause what you wrote looked too easy. Trying to get all
CNAME records and compare them on the client side is of course not an
option.

Ronny
  Reply With Quote
Old 04-02-2006, 04:25 AM   #9
Zero
 
Posts: n/a
Default Re: Please help: How to get the alias hostname ??

Thank U for all the guys worked on this topic. U are really good and
helpful.
It seems it is necessary for me to talk to my teacher about her foolish
requirement.
Thank U again ^_^

  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump