![]() |
|
|
|||||||
![]() |
Java - Please help: How to get the alias hostname ?? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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? |
|
|
|
#3 |
|
Posts: n/a
|
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 |
|
|
|
#4 |
|
Posts: n/a
|
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. |
|
|
|
#5 |
|
Posts: n/a
|
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 |
|
|
|
#6 |
|
Posts: n/a
|
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. |
|
|
|
#7 |
|
Posts: n/a
|
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. |
|
|
|
#8 |
|
Posts: n/a
|
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 |
|
|
|
#9 |
|
Posts: n/a
|
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 ^_^ |
|