There is no easy way to do this. You will have to call local system commands and analyze the output, read configuration files or the registry. There is no platform-independent way that I know to make this work β you'll have to code for Linux, Mac, and Windows if you want to run them on everyone.
See How to determine the IP address of my router / gateway in Java?
This covers the gateway, and you can use ifconfig or ipconfig to get this. For DNS information, you will have to call another system command, such as ipconfig, on Windows or parse / etc / resolv.conf for Linux or Mac.
squawknull
source share