Currently using HttpServletRequest, I can get the IP address of the client that sent the request over the internet, by calling getRemoteAddr() method. But, I also need the client's IP address in its own Local Area Netwokk. Does anyone know how to get the client's internal LAN IP Address?? Is this possible ?
It sounds like the clients lan is using NAT (Network Address Translation). From what I know about NAT is that it is doing it's job so that you cannot see their internal IP. If That doesn't sound right, please someone speak up.
When I connect to your application from where I am now, you can see the IP address of our proxy server, which is a public IP address starting with 204, I think. But my private address in our LAN is 10.20. something, and you can't see that. This is as it should be.
Why do you think you need to see private IP addresses? If you have a design that relies on that, then there's something wrong with it and it needs to be fixed. Would you like to explain the problem a little more?
Joined: Jan 24, 2007
Currently, when the branch of the company login to the system, we keep track of the 'action' and IP address, but beside the IP address that we obtain from the NAT, we also want to keep track of the local IP in LAN, so that we know directly, which computer access the system.
That's why I need to know the private IP addresses.
If you need to actually know which machine logged onto the system, then you should be using MAC Addresses and not IP Addresses. A MAC Address can only be changed through a hardware modification, whereas an IP Address can be changed at any time (and many times, at least through DHCP, is changed dynamically at boot). But in either case, you will need to modify your login system to pass this information along, you cannot receive it remotely. And then keep in mind, that this info could be spoofed if anyone attempts to access the system through something other than your login process.
Joined: Jan 24, 2007
Dear sir, thank you for your quick reply.
I'm interested in your solution about passing the information of the client along while doing the login process. But could you help me about what information that i could use ? The application is web based. Is it possible for my login page to look for the machine's mac address ?
Unfortunately, I think the only way to get a client machine's NAT'ed IP address is to do it cooperatively. Your client software has to do it, and pass it as part of the service request.
The router (protecting the private network) generally does a very good job at it. And will not even tell you it is doing network address translation for other machines. In fact, besides monitoring usage patterns, it should be impossible for you to even tell there is a private network behind it.