Page 1 of 1

[resolved] Route in VPN subnet

Posted: Sun Dec 25, 2011 12:15 am
by rgawron
Hello

I install OpenVPN on CentOS ( server and client )
Client don't have access to my server subnet.
My VPN server have public IP and have connect to subnet 192.168.5.0/255.255.255.0
I can ping client to 10.8.0.6 but my client don't have access to subnet

Configuration files:
Server:

Code: Select all

port 1194
proto udp
dev tun
ca klucze/ca.crt
cert klucze/server.crt
dh klucze/dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 192.168.5.0 255.255.255.0"
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
netstat -nr

Code: Select all

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.8.0.2        0.0.0.0         255.255.255.255 UH        0 0          0 tun0
publicNet      0.0.0.0         255.255.255.192 U         0 0          0 eth0
10.8.0.0        10.8.0.2        255.255.255.0   UG        0 0          0 tun0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         publicGateway      0.0.0.0         UG        0 0          0 eth0


Client:
client

Code: Select all

dev tun
proto udp
remote publicIP 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca klucze/ca.crt
cert klucze/client.crt
key klucze/client.key
ns-cert-type server
comp-lzo
verb 3
netstat -nr

Code: Select all

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.8.0.5        0.0.0.0         255.255.255.255 UH        0 0          0 tun0
10.8.0.1        10.8.0.5        255.255.255.255 UGH       0 0          0 tun0
192.168.5.0     10.8.0.5        255.255.255.0   UG        0 0          0 tun0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
Can somebody help me ?

Re: Route in VPN subnet

Posted: Sun Dec 25, 2011 10:37 am
by Mimiko

Re: Route in VPN subnet

Posted: Tue Dec 27, 2011 8:51 pm
by rgawron
OK, thanks for answer. I read this documentation and i add push route my subnet
to config file - in accordance with section "Including multiple machines on the server side when using a routed VPN (dev tun)"

In server I can ping ma subnet 192.168.5.0 but my client ping only server 10.8.0.1
On both machine was ip_forwarding enabled.

When I connect 2 client they can ping: example 10.8.0.6. -> 10.8.0.10

What can I do to subnet the server to be visible?
server.conf

Code: Select all

port 1194
proto udp
dev tun
ca ca.crt
cert Server.crt
key Server.key  # This file should be kept secret
dh dh1024.pem
server 10.8.0.0 255.255.255.0
#ifconfig-pool-persist ipp.txt
push "route 192.168.5.0 255.255.255.0"
route 192.168.5.0 255.255.255.0
client-to-client
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
log         openvpn.log
log-append  openvpn.log
verb 3

-------------------------- EDIT -------------------------------------

Mimiko tutorial and method 4 :) topic9465.html
This tutorial is very helpful - my VPN works just like I wanted. Thans for this howto ;)