Hi all.
I've been using openVPN in bridged mode I switched over to routed because I wanted to connect from openVPN connect for Android.
I have a problem with routed VPN:
For some reason after connecting, the default route changes to the remote p-t-p thus stopping access to the internet from the client (I DON'T want to route all traffic via VPN, just the requests to the server's subnet)
Below are the details of my networks' setup:
Server LAN gateway (ISP locked router): 192.168.1.1/24
Server IP: 192.168.1.50/24
Server Distro: OpenSUSE 13.1 x64
Port forwarding (NAT) on router publicIP:51194 -> 192.168.1.50:1194
/proc/sys/net/ipv4/ip_forward = 1
Client LAN gateway (ISP locked router): 192.168.10.254/24
Client IP: 192.168.10.1/24
Client VPN IP: 10.8.0.10/24
Client Distro: OpenSUSE 13.1 x64
Server.conf
port 1194
proto udp
dev tun
ca /etc/openvpn/ssl/ca.crt
cert /etc/openvpn/ssl/server.crt
key /etc/openvpn/ssl/server.key # This file should be kept secret
dh /etc/openvpn/ssl/dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist /var/run/openvpn/ipp.txt
push "route 192.168.1.0 255.255.255.0"
keepalive 10 120
comp-lzo
max-clients 5
user nobody
group nobody
persist-key
persist-tun
status /var/log/openvpn-status.log
log-append /var/log/openvpn.log
verb 4
Client.conf
client
dev tun
proto udp
remote xxxx 51194
resolv-retry infinite
nobind
user nobody
group nobody
persist-key
persist-tun
ca /etc/openvpn/ssl/ca.crt
cert /etc/openvpn/ssl/asusClient.crt
key /etc/openvpn/ssl/asusClient.key
ns-cert-type server
comp-lzo
verb 5
Server ifconfig
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
Server routes #route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 enp7s0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 enp7s0
Client ifconfig
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.10 P-t-P:10.8.0.9 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
Client routes
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
[b]0.0.0.0 10.8.0.9 0.0.0.0 UG 0 0 0 tun0[/b]
10.8.0.1 10.8.0.9 255.255.255.255 UGH 0 0 0 tun0
10.8.0.9 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
178.59.42.187 192.168.10.254 255.255.255.255 UGH 0 0 0 eth0
192.168.1.0 10.8.0.9 255.255.255.0 UG 0 0 0 tun0
192.168.10.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
As you can see, for the 1st issue, the problem lies in the client default route that gets changed resulting in no internet access.
Deleting the route with
route del default gw 10.8.0.9 netmask 0.0.0.0
and adding the one that preexisted before connecting to the VPN with
route add default gw 192.168.10.254
works, but has to be done every time upon connecting and isn't really a solution because probably there is something going something wrong that needs to get fixed.
Any ideas? I've been searching the docs and the web for a few hours and only found issues with wanting to push redirect-gateway.