Routing problem with OpenVPN on Linux

Need help configuring your VPN? Just post here and you'll get that help.

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
AMG
OpenVpn Newbie
Posts: 5
Joined: Fri Aug 27, 2010 3:53 pm

Routing problem with OpenVPN on Linux

Post by AMG » Fri Aug 27, 2010 3:58 pm

I have an Asus RT-N16 router with DD-WRT on it. The IP of this router is 192.168.1.1. I have a Linux server with OpenVPN on it. The IP of the Linux server is 192.168.1.99. I have OpenVPN setup for routing not bridging. The IP address for tun0 in Linux is 192.168.2.1. When connected on the VPN from my Windows client I can access anything that is on the Linux server (192.168.1.99) but I cannot access other servers on my network (most importantly anything on 192.168.1.xxx). I think I somehow need to tell my router that anything that goes to 192.168.2.xxx to route through my VPN IP? I am kind of lost, so I finally decided to post here. Thanks for your help!

I have also tried adding a route from the DD-WRT web UI under "Advanced Routing" to route all traffic in 192.168.2.0 to the gateway 192.168.1.99 (the IP of the Linux server where OpenVPN is running)

[routing table on the physical router - asus RT-n16, running dd-wrt)
root@router:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
76.176.160.1 * 255.255.255.255 UH 0 0 0 vlan2
192.168.2.0 Revo 255.255.255.0 UG 0 0 0 br0
192.168.1.0 * 255.255.255.0 U 0 0 0 br0
76.176.160.0 * 255.255.248.0 U 0 0 0 vlan2
169.254.0.0 * 255.255.0.0 U 0 0 0 br0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default cpe-76-176-160- 0.0.0.0 UG 0 0 0 vlan2

[routing table on my linux server (Revo) which is 192.168.1.99 now]
$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.2 * 255.255.255.255 UH 0 0 0 tun0
192.168.2.0 192.168.2.2 255.255.255.0 UG 0 0 0 tun0
192.168.1.0 * 255.255.255.0 U 2 0 0 wlan0
link-local * 255.255.0.0 U 1000 0 0 wlan0
default router 0.0.0.0 UG 0 0 0 wlan0


[server.conf]
local 192.168.1.99
port 1194
proto tcp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh1024.pem
push "route 192.168.1.0 255.255.255.0"
ifconfig-pool-persist ipp.txt
server 192.168.2.0 255.255.255.0
keepalive 10 120
tls-auth ta.key 0 # This file is secret
comp-lzo
max-clients 10
status openvpn-status.log
log openvpn.log
verb 3


[client config]
remote <my_external_facing_host_or_ip> 1194
dev tun
client
remote-cert-tls server
proto tcp
resolv-retry infinite
nobind
comp-lzo
float
verb 3
ca ca.crt
cert <my_client_DN>.crt
key <my_client_DN>.key
tls-auth ta.key

User avatar
krzee
Forum Team
Posts: 728
Joined: Fri Aug 29, 2008 5:42 pm

Re: Routing problem with OpenVPN on Linux

Post by krzee » Tue Sep 07, 2010 3:21 am

http://www.secure-computing.net/wiki/in ... PN/Routing
you may need the section "ROUTES TO ADD OUTSIDE OPENVPN"
but i can not guarantee that part is the problem, since you said you did add a route to the router.

AMG
OpenVpn Newbie
Posts: 5
Joined: Fri Aug 27, 2010 3:53 pm

Re: Routing problem with OpenVPN on Linux

Post by AMG » Tue Sep 07, 2010 3:41 am

I should have updated this thread.
I did in fact fix it and it's been working perfectly.

I added this line to my server configuration file.

route 192.168.201.0 255.255.255.0

Oh, I also switched from 192.168.1.0 and 192.168.2.0 to 192.168.200.0 and 192.168.201.0 So basically adding the route line. I already had the line:
push "route 192.168.200.0 255.255.255.0"
present, but I also needed the other.
thanks.

Post Reply