Hi,
I have the following configuration:
- OpenVPN Server on a raspi with address 192.168.0.14 and 10.5.5.2 for the OpenVPN side.
- Hardware router with OpenWRT on address 192.168.0.1
- File Server to access 192.168.0.11
The good news is I can connect from the internet using OpenVPN apps without problem. I can login with ssh on my OpenVPN server. I can access all hosts within my local network 192.168.0.* using ping on my OpenVPN-server without problems. But I cannot reach the file server or any other host except the OpenVPN-server and the router directly from the OpenVPN client!
My OpenVPN client gets an address like 10.5.5.6
I have the following routing tables:
On OpenVPN-Server:
Code:
$ netstat -nr
Kernel-IP-Routentabelle
Ziel Router Genmask Flags MSS Fenster irtt Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
10.5.5.0 10.5.5.2 255.255.255.0 UG 0 0 0 tun0
10.5.5.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
On Router:
Code:
$ netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth1
10.5.5.0 192.168.0.14 255.255.255.0 UG 0 0 0 br-lan
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lan
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
On my file server:
Code:
$ netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
When I ping my file server from the OpenVPN client I get no responce.
When I traceroute my client I get:
Code:
$ traceroute 10.5.5.6
traceroute to 10.5.5.6 (10.5.5.6), 30 hops max, 60 byte packets
1 OpenWrt.lan (192.168.0.1) 2.156 ms 2.102 ms 2.077 ms
2 OpenWrt.lan (192.168.0.1) 2.062 ms 2.797 ms 2.787 ms
When I add the following route:
Code:
# route add -net 10.5.5.0 netmask 255.255.255.0 gateway 192.168.0.14
I can traceroute my OpenVPN client:
Code:
$ traceroute 10.5.5.6
traceroute to 10.5.5.6 (10.5.5.6), 30 hops max, 60 byte packets
1 raspberrypi.lan (192.168.0.14) 4.336 ms 4.304 ms 4.282 ms
2 10.5.5.6 (10.5.5.6) 89.269 ms 92.398 ms 92.388 ms
Why is it not sufficient to set a route to the VPN-Server on my router?
I would expect that a ping from my client to a host in my network will go the following path:
10.5.5.6-->10.5.5.2-->192.168.0.14-->192.168.0.11
The responce should go:
192.168.0.11-->192.168.0.1-->192.168.0.14-->10.5.5.2-->10.5.5.6
But only with the manually added static route it goes:
192.168.0.11-->192.168.0.14-->10.5.5.2-->10.5.5.6
As a short workaround I added this static route manually to some of the hosts I want to connect using my OpenVPN clients.
But why is the route to the VPN-Server on the router (default gateway for all hosts in the local network) not sufficient? A packet to a host with address 10.5.5.6 should be sent to the default gateway and the forwarded to the OpenVPN-server by the deafault gateway. Why is that not working?
Can anybody explain?