Hello!
I've a NAS where I'm running OpenVPN on a Debian 8 VM (192.168.1.10). Everything is setup and working perfectly when connecting with my iPhone. I also have a DNS server installed on a raspberry PI (192.168.1.100) to filter ads. My router configuration has as DNS my raspberry PI so anyone that uses my Wifi gets ads filtering automatically.
So, on my iPhone connected through the VPN, I can access internet or local net IPs without problems... no matter if I'm connected to the Wifi or over 4G. But the thing is that I don't always want all the traffic to go through my VPN, as it makes my mobile phone connection a bit slow. I would like to have the option to also only route DNS queries through my VPN so I can ask my raspberry PI (DNS server) and get ad filtering anywhere.
I've read several tutorials, wikis and how to and I can't find a way to do it. I've tried removing "redirect-gateway" on both server and client, and I can connect well. But when I'm on 4G my iPhone is not asking my DNS server, instead I think it's using the one provided by my ISP. I've also tried forcing the DNS on both client and server configs, but it didn't work either. I'm out of ideas 🙁
Below are my client and server configurations (with redirect-gateway enabled, but as I said... I tried with the line commented too)
Server.conf
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "dhcp-option DNS 192.168.1.110"
push "dhcp-option DNS 192.168.1.110"
keepalive 10 120
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
Client.conf
client
dev tun
proto udp
remote my.host.com 1194
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
redirect-gateway def1
dhcp-option DNS 192.168.1.110
ns-cert-type server
comp-lzo
verb 3
[BELOW GOES CERT, ETC]