File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get internal LAN IP Address

 
Neir Kate
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

Please help, it's urgent ^_^

Thanks in advance
Kate
 
Jimmy Die
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Best
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Neir Kate
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks, best regards,
Neir Kate
 
Martin Simons
Ranch Hand
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Neir Kate
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Henry
 
Martin Simons
Ranch Hand
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, as Mr.Wong pointed out, the client side of your login would have to collect the info and pass it along. This has a lot of problems in a web environment as you would have to use something along the lines of an Applet or JavaScript to attempt to gather this information and there are many ways in which the user can disable this sort of access to their system (and most of them are, now adays, active per default). So you would need the user to actively "open" these security holes on their system, and I don't think this would be appreciated. It would also be, as I believe I mentioned before, easily spoofable which would, again, make the information unreliable. (Which everything gathered through a browser on a client through either an Applet or JavaScript is unreliable.)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic