-3

I want to get the internet(public) ip address and use it in my java app. When I use "ipconfig" or "netstat" (shell commands) or InetAddress.getLocalHost() or even NetworkInterface.getNetworkInterfaces() the router(system) doesn't return the internet ip, instead returns the local address. enter image description here

However when I connect to router config page using a browser the internet ip address is shown there. How can I get the internet ip address in my java app?

rouiiii
  • 47
  • 6

1 Answers1

1

If your router supports TR-064 there might be a chance to obtiain the public INET address assuming the vendor supports this query.

Stefan D.
  • 299
  • 3
  • 8