openvpnproxies

How to use Android phone as proxy for other clients in OpenVPN network


I will describe what I have at the moment, and at the end I will describe the problem.

I have:

OpenVPN 2.4.7 x86_64-pc-linux-gnu is installed on the Ubuntu VPS and has a status of "active". service openvpn status

Server config (serv)

local SEVERIP
port SERVERPORT
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
tls-crypt tc.key
topology subnet
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1 bypass-dhcp"
ifconfig-pool-persist ipp.txt
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "block-outside-dns"
keepalive 10 120
cipher AES-256-CBC
user nobody
group nogroup
persist-key
persist-tun
verb 3
crl-verify crl.pem
explicit-exit-notify

OpenVPN for Android is installed on the phone and the client1 profile is imported into it.It's assigned IP 10.8.0.2

OpenVPN GUI v11.43.0.0 is installed on the Windows VDS and the client2 profile is imported into it.It's assigned IP 10.8.0.3

Client profile settings (for both clients):

client
dev tun
proto udp
remote SEVERIP SERVERPORT
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
auth SHA512
cipher AES-256-CBC
ignore-unknown-option block-outside-dns
verb 3

A Proxy Server is also installed on the phone. An HTTP/HTTPS proxy server is created with the specified host 0.0.0.0 and port 31313. Mobile internet is connected. WiFI is switched off.

Now closer to the problem:

On my Windows VDS, I set 10.8.0.2:31313 as a proxy in the HTTP client. Then I make a request to https://api64.ipify.org and get the IP address of my Ubuntu server. At the same time this request is shown in the log of my Android proxy server, which means that my phone's proxy server was used.

The problem is that I got the IP address of the server, but I was planning to get the IP address of my mobile phone.

How can I make my Windows VDS use the external IP address of my mobile phone when making an http-request?

Any help would be appreciated. Thanks.


Solution

  • The solution turned out to be quite simple. All I had to do on my phone was disable routing in OpenVPN for Android -> Edit profile -> Routing. Screenshot1 Screenshot2