Page 1 of 1

Android client connecting to my personal OpenVPN server, but not updating IP.

Posted: Sat May 06, 2017 6:08 pm
by atoy3731
Hi all,

I have an OpenVPN server in my house that I'm trying to set up to work with my Android phone. I have the client installed and connecting fine, but when I go to http://www.whatismypublicip.com/ to see my IPv4 IP, it is still using my phone provider's IP. I also can't resolve any of the local IPs behind the VPN. Any ideas?

Here's a screenshot of me connected:
Image

And here's my server config:

Code: Select all

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.0
#push "redirect-gateway def1 bypass-dhcp"
#push "dhcp-option DNS 8.8.8.8"
keepalive 10 120
comp-lzo
user nobody
group nobody
persist-key
persist-tun
log-append  /var/log/openvpn.log
verb 6
And lastly, my client config:

Code: Select all

client
dev tun
proto udp
remote <REMOTE-HOSTNAME> 1194
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo
verb 3
<ca>
* THE CA INFO IS HERE *
</ca>
<cert>
* THE CERT INFO IS HERE *
</cert>
<key>
* THE KEY INFO IS HERE *
</key>

Re: Android client connecting to my personal OpenVPN server, but not updating IP.

Posted: Mon Jun 05, 2017 12:30 am
by dffvb
I have exactly the same question... I got ther server up and running and from android device it tells me another ip than from the server, how?

Re: Android client connecting to my personal OpenVPN server, but not updating IP.

Posted: Thu Jun 29, 2017 2:57 pm
by plkw
Hi here,

I have exactly the same issue...
It works fine on Windows but the Android App can't switch to the VPN IP... I can't figure out why and how to solve this...

Re: Android client connecting to my personal OpenVPN server, but not updating IP.

Posted: Mon Jul 03, 2017 5:45 am
by kevinvanhooren
Hi all,

To access local IP's, you need to add following line in your server.conf: push "route 192.168.1.0 255.255.255.0"
Changing the '192.168.1.0' to your local network parameters.

And it's perfectly normal that your phone is still using your providers IPv4 address. This IP is used to connect to your VPN.
If you want to route all your internet traffic through your VPN, you need to uncomment these two lines:
#push "redirect-gateway def1 bypass-dhcp"
#push "dhcp-option DNS 8.8.8.8"

Also change 'verb' to 3 or 4.
6 is only used to help to debug connection problems

Grtz

Re: Android client connecting to my personal OpenVPN server, but not updating IP.

Posted: Mon Jul 03, 2017 8:51 am
by plkw
Hi,

Considering your answer is the right thing to do, how do you explain that from my laptop, connnected out of home, I can manage to retrieve the home IP adress to browse the web with the exactly same config file ?

Now, about the config file, this is what I have at the moment in it :

Code: Select all

dev tun
tls-client

remote DOMAINNAME PORT

# The "float" tells OpenVPN to accept authenticated packets from any address,
# not only the address which was specified in the --remote option.
# This is useful when you are connecting to a peer which holds a dynamic address
# such as a dial-in user or DHCP client.
# (Please refer to the manual of OpenVPN for more information.)

#float

# If redirect-gateway is enabled, the client will redirect it's
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)

#redirect-gateway def1

# dhcp-option DNS: To set primary domain name server address.
# Repeat this option to set secondary DNS server addresses.

#dhcp-option DNS DNS_IP_ADDRESS

pull

# If you want to connect by Server's IPv6 address, you should use
# "proto udp6" in UDP mode or "proto tcp6-client" in TCP mode
proto udp

script-security 2


comp-lzo

reneg-sec 0

auth-user-pass
<ca>
-----BEGIN CERTIFICATE-----
...

Re: Android client connecting to my personal OpenVPN server, but not updating IP.

Posted: Fri Jul 07, 2017 6:33 pm
by kevinvanhooren
Hi plkw,

Because you're using different config than atoy. You're using the 'pull' function. You get your settings from the openvpn server itself. So it all depends what's in your sever config file.

If you uncomment the #push "redirect-gateway def1 bypass-dhcp" and #push "dhcp-option DNS 8.8.8.8" or not, you will always be able to surf on the internet.
Commented: you're not surfing through your VPN
Uncommented: all internet traffic will be routed through VPN