3

-Environment-

  1. VPN connection(OpenVPN)
    -Default gateway is changed into VPN server IP
    -Virtual interface(tunXX) for VPN connection directly connects to a default gateway

  2. Interfaces & default gateway

    interfaces :
      lo        inet addr:127.0.0.1
      wlan0     inet addr:150.149.131.5
      tun0      inet addr:10.8.0.14
    
    default gateway : 10.8.0.2
    

In this environment, I want to know "10.8.0.14" regardless of the interface name using Android API.

I cound find only a way to get default route IP address below

mSocket = new Socket(dstAddress, peerPortNum); 
mStrMyIPAddr = mSocket.getLocalAddress().getHostAddress();

But, I don not want to use Socket

jazzsir
  • 609
  • 2
  • 7
  • 14

0 Answers0