Issue with IP forwarding?

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
johnsnow225
OpenVpn Newbie
Posts: 1
Joined: Wed Mar 22, 2017 3:13 pm

Issue with IP forwarding?

Post by johnsnow225 » Wed Mar 22, 2017 3:43 pm

Hello, I'm not really sure IP forwarding is the issue since I am not a network-ey person but I will provide as much information as I can about the problem!
I have a VPS on which I have installed an openvpn server using this script: https://github.com/Nyr/openvpn-install

The script created the server.conf and the client.ovpn which are below:
server.conf
port 1194
proto udp
dev tun
sndbuf 0
rcvbuf 0
ca ca.crt
cert server.crt
key server.key
dh dh.pem
tls-auth ta.key 0
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 64.6.64.6"
push "dhcp-option DNS 64.6.65.6"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
crl-verify crl.pem
client.ovpn
client
dev tun
proto udp
sndbuf 0
rcvbuf 0
remote VPS_PUBLIC_IP_HERE 1194
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
cipher AES-256-CBC
comp-lzo
setenv opt block-outside-dns
key-direction 1
verb 3
<ca>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</ca>
<cert>
Certificate:
.
.
.
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
</key>
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
-----END OpenVPN Static key V1-----
</tls-auth>
I know that this configuration works because I was able to use it to tunnel through the VPS. However, I noticed that when I use the ovpn on my android, it works correctly but not when I use it on my laptop - when I browse the website on my server, it logs my home public ip instead of the internal tun ip. Here are the nginx logs which I saw on the server:
Android connects
10.8.0.2 - - [22/Mar/2017:04:37:46 +0000] "GET /favicon.ico HTTP/2.0" 401 174 "https://my.domain.com" "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36"
Laptop connects
MY_HOME_PUBLIC_IP - - [22/Mar/2017:04:39:38 +0000] "GET / HTTP/2.0" 403 276 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36"
I am using the community openvpn client (v0.6.63 in the about page?) on my android and I'm using openvpn (v2.4.0-3) from debian's repo on my laptop.

I have IP forwarding enabled too on both my server and laptop
ip forwarding
$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
I did a DNS leak test on my laptop and it came up negative and shows my VPS IP which makes it more confusing to me.
I don't know if this is an issue but I would like to fix it so I can connect to an internal facing webapp which I have set up which listens for 10.8.0.0/24. (Works for android but not on my laptop with the same ovpn config file)
Could anyone help me with this issue? Is there some configuration which I should have done on my laptop?

Post Reply