HOw Can i get Public IP using Private IP
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, January 29, 2004 01:32 PM

I got a scenario like, i need to develop a java program that will get localmachine ip when that PC get connected to internet using cable modems. When a PC get connection to the internet using cable modems they get Dynamic IP given by the Service Provider.But this IP is private IP.I can't call a server running on that machine using this private IP.so i need to get Public ip of that PC.I can get local PC ip using some java classes that are in java.net.*. But i can get only private IP of this PC.But i need to get the Public IP of this PC which was internelly given by Internet service provider to this PC. So How can i get Public IP of this pC based on private IP. Or Is there any Way to get this work to be done? Help will be appreciated.   More>>

I got a scenario like, i need to develop a java program that will get localmachine ip when that PC get connected to internet using cable modems. When a PC get connection to the internet using cable modems they get Dynamic IP given by the Service Provider.But this IP is private IP.I can't call a server running on that machine using this private IP.so i need to get Public ip of that PC.I can get local PC ip using some java classes that are in java.net.*.
But i can get only private IP of this PC.But i need to get the Public IP of this PC which was internelly given by Internet service provider to this PC.
So How can i get Public IP of this pC based on private IP.
Or Is there any Way to get this work to be done?
Help will be appreciated.

   <<Less

Re: HOw Can i get Public IP using Private IP

Posted By:   Rais_Ahmad  
Posted On:   Monday, February 2, 2004 04:28 AM

If you are parsing a website, I would recommend parsing your router's web or command-line interface or some server you have control on.


Some networking tools are available at:

http://netdept.com/netTools.jsp


Your IP address and hostname can be found at:
http://www.netdept.com/ipandhost.jsp


Thanks.

Re: HOw Can i get Public IP using Private IP

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, January 29, 2004 02:57 PM

I suppose it would depend on the NAT in the cable modem or at the provider. (NAT = Network Address Translation, the mapping between your "private IP" and "public IP")


But, are you expecting that you can access services hosted on machine A, from some other machine B, where machine A is on your private network behind your cable modem, but machine B is elsewhere on the Internet, e.g. is NOT on that same private local network? This would depend on your provider's policy, if it allows server connections inbound, if the source routing will work out right with the NAT for how your service works, etc.


If both machine A and machine B are on your private local net, then there is no reason why you cannot access services, from machine B, at the "private IP" address of machine A, since that is entirely valid, within that local network segment (it just is not routed to any other network segment, that's what makes it "private").

About | Sitemap | Contact