Routing problem
Posted: Thu Sep 23, 2010 2:38 pm
Hi all.
I'm setting up my first VPN and having trouble. Here's the situation:
OpenVPN server on 192.168.1.3 (I know I shouldn't be using that subnet. I plan to change it once I get my head around this)
Gateway at 192.168.1.1
Various other machines on 192.168.1.x
server.conf:
client.conf:
I have added a route on the gateway at 192.168.1.1, going from 10.8.0.0 255.255.255.0 to 192.168.1.3, and I have UDP port 1194 forwarded to 192.168.1.3.
So, here's the problem. A client at a different location can connect to the VPN, and gets an IP of 10.8.0.6. Once connected, the client machine can successfully ping 10.8.0.1 and 192.168.1.3, but not any other machines on the 192.168.1.0 network. Also while the VPN client is connected, from any of the 192.168.1.x machines I can successfully ping 10.8.0.1, but not 10.8.0.6.
Maybe I am misinterpreting this, but it looks to me like the route on the gateway is working correctly, but the OpenVPN server itself is not routing things through to the 10.8.0.0 subnet. I suspect that my pings from the client are getting through to the right machine, but are unable to get back through the VPN server.
While the OpenVPN server is running, the route table on that machine looks like this:
Destination Gateway Genmask Flags Metric Ref Use Iface
10.8.0.2 * 255.255.255.255 UH 0 0 0 tun0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 100 0 0 eth0
And ifconfig shows this:
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
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:924 (924.0 B) TX bytes:336 (336.0 B)
I don't know anything about point-to-point interfaces, so I'm not sure how the 10.8.0.2 address figures into things, but aside from that uncertainty the route table looks about right to me.
What's missing here?
Edit: Just to clarify, my intention is to allow single PCs to connect to the VPN from anywhere and access anything on the LAN behind it. The clients should be assumed to be on the road somewhere, so do not need to make their own LAN accessible to anything at the server end of the connection.
I'm setting up my first VPN and having trouble. Here's the situation:
OpenVPN server on 192.168.1.3 (I know I shouldn't be using that subnet. I plan to change it once I get my head around this)
Gateway at 192.168.1.1
Various other machines on 192.168.1.x
server.conf:
Code: Select all
port 1194
proto udp
dev tun
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key # This file should be kept secret
dh /etc/openvpn/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 192.168.1.0 255.255.255.0"
client-to-client
keepalive 10 120
comp-lzo
max-clients 2
persist-key
persist-tun
status openvpn-status.log
verb 3
Code: Select all
client
dev tun
proto udp
remote <mydomain>.dyndns.org 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /home/tony/.openvpn/ca.crt
cert /home/tony/.openvpn/tony.crt
key /home/tony/.openvpn/tony.key
ns-cert-type server
comp-lzo
verb 3
So, here's the problem. A client at a different location can connect to the VPN, and gets an IP of 10.8.0.6. Once connected, the client machine can successfully ping 10.8.0.1 and 192.168.1.3, but not any other machines on the 192.168.1.0 network. Also while the VPN client is connected, from any of the 192.168.1.x machines I can successfully ping 10.8.0.1, but not 10.8.0.6.
Maybe I am misinterpreting this, but it looks to me like the route on the gateway is working correctly, but the OpenVPN server itself is not routing things through to the 10.8.0.0 subnet. I suspect that my pings from the client are getting through to the right machine, but are unable to get back through the VPN server.
While the OpenVPN server is running, the route table on that machine looks like this:
Destination Gateway Genmask Flags Metric Ref Use Iface
10.8.0.2 * 255.255.255.255 UH 0 0 0 tun0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 100 0 0 eth0
And ifconfig shows this:
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
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:924 (924.0 B) TX bytes:336 (336.0 B)
I don't know anything about point-to-point interfaces, so I'm not sure how the 10.8.0.2 address figures into things, but aside from that uncertainty the route table looks about right to me.
What's missing here?
Edit: Just to clarify, my intention is to allow single PCs to connect to the VPN from anywhere and access anything on the LAN behind it. The clients should be assumed to be on the road somewhere, so do not need to make their own LAN accessible to anything at the server end of the connection.