troubleshooting Question

Retrieving local IP assigned from VPN DHCP

Avatar of deve-lopez
deve-lopezFlag for United States of America asked on
JavaNetworkingTCP/IP
10 Comments1 Solution300 ViewsLast Modified:
Hi,

My computer is connected to Internet via a Router.
The Router is connected to my ISP.
I connect to an Office WAN via a VPN connection.

Using Java code:
I need to retrieve the Dynamic IP address assigned to my computer by the VPN DHCP.

I tried to use the code sample bellow but it returns the LAN IP address.
My knowledge of the package java.net.* is limited.

Any help would be greatly appreciated.

Thanks
InetAddress address = InetAddress.getLocalHost();
System.out.println(address.toString()); // returns 10.0.1.1 (the LAN IP assigned by the router)
ASKER CERTIFIED SOLUTION
Mick Barry
Java Developer
Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros