[SOLVED] problem setting up routing in openvpn
Posted: Fri Jun 03, 2011 9:59 am
Hi,
I'm having problems setting up the routing for openvpn.
first I'd like to tell you my network layout:
client -> firewall with publich ip and nat -> openvpn with private network
client: comes from anywhere in the internet
this is my server config:
#####################################################
local 172.22.104.32
port 24577
proto udp
dev tun
ca keys/ca.crt
cert keys/server.crt
key keys/server.key # This file should be kept secret
dh keys/dh1024.pem
# means 10.0.6.32/28 10.0.6.33 - 46
server 10.0.6.32 255.255.255.240
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
persist-key
persist-tun
verb 3
push "route 172.22.104.0 255.255.255.0"
management localhost 7505
#####################################################
this is my client config:
#####################################################
#
# local openvpn.conf
#
dev tun
remote <<public-ip>>
client
#tls-client
ca dedipower/ca.crt
cert dedipower/uwebartels.crt
key dedipower/uwebartels.key
port 24577
#user nobody
#group nogroup
comp-lzo
key-method 2
ping 45
ping-restart 600
ping-timer-rem
persist-tun
persist-key
verb 3
pull
route 172.22.104.0 255.255.255.0 vpn_gateway
#####################################################
connecting to the openvpn works fine.
connecting from the client to the ssh daemon via the private network works as well. <<root@client # ssh root@172.22.104.32>>
connecting from 172.22.104.32 to a ssh daemon in the same private network works. <<root@server # ssh root@172.22.104.33>>
connecting from the client to a ssh daemon in the same private network does not work. <<root@client # ssh root@172.22.104.33>>
pinging from the client to a ssh daemon in the same private network does not work. <<root@client # ping 172.22.104.33>>
I raised verbosity level to 6 over the management interface and these lines came out during the ing above. 34.23.12.67 corresponds to the public ip in the firewall which is nat'ed to the private ip 172.22.104.32
Jun 3 10:48:47 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 READ [53] from 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:48:55 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 WRITE [53] to 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:05 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 WRITE [53] to 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:07 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 READ [53] from 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:15 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 WRITE [53] to 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:17 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 READ [53] from 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:25 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 WRITE [53] to 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
the ping packets are not received by the pinged server 172.22.104.33 - checked with tcpdump.
bit there are packet coming in on the openvpnserver - checked with tcpdump.
So for me it looks like the packets are sent to openvpn, and openvpn does not send them to the given ip - it sends them back to the public ip accoring to the log above. however I don't know what's wrong. Any idea?
All the ip addresses are changed for security reasons of course.
best regards,
Uwe
I'm having problems setting up the routing for openvpn.
first I'd like to tell you my network layout:
client -> firewall with publich ip and nat -> openvpn with private network
client: comes from anywhere in the internet
this is my server config:
#####################################################
local 172.22.104.32
port 24577
proto udp
dev tun
ca keys/ca.crt
cert keys/server.crt
key keys/server.key # This file should be kept secret
dh keys/dh1024.pem
# means 10.0.6.32/28 10.0.6.33 - 46
server 10.0.6.32 255.255.255.240
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
persist-key
persist-tun
verb 3
push "route 172.22.104.0 255.255.255.0"
management localhost 7505
#####################################################
this is my client config:
#####################################################
#
# local openvpn.conf
#
dev tun
remote <<public-ip>>
client
#tls-client
ca dedipower/ca.crt
cert dedipower/uwebartels.crt
key dedipower/uwebartels.key
port 24577
#user nobody
#group nogroup
comp-lzo
key-method 2
ping 45
ping-restart 600
ping-timer-rem
persist-tun
persist-key
verb 3
pull
route 172.22.104.0 255.255.255.0 vpn_gateway
#####################################################
connecting to the openvpn works fine.
connecting from the client to the ssh daemon via the private network works as well. <<root@client # ssh root@172.22.104.32>>
connecting from 172.22.104.32 to a ssh daemon in the same private network works. <<root@server # ssh root@172.22.104.33>>
connecting from the client to a ssh daemon in the same private network does not work. <<root@client # ssh root@172.22.104.33>>
pinging from the client to a ssh daemon in the same private network does not work. <<root@client # ping 172.22.104.33>>
I raised verbosity level to 6 over the management interface and these lines came out during the ing above. 34.23.12.67 corresponds to the public ip in the firewall which is nat'ed to the private ip 172.22.104.32
Jun 3 10:48:47 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 READ [53] from 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:48:55 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 WRITE [53] to 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:05 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 WRITE [53] to 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:07 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 READ [53] from 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:15 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 WRITE [53] to 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:17 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 READ [53] from 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
Jun 3 10:49:25 localhost openvpn[32337]: uwebartels/34.23.12.67:55469 UDPv4 WRITE [53] to 34.23.12.67:55469: P_DATA_V1 kid=0 DATA len=52
the ping packets are not received by the pinged server 172.22.104.33 - checked with tcpdump.
bit there are packet coming in on the openvpnserver - checked with tcpdump.
So for me it looks like the packets are sent to openvpn, and openvpn does not send them to the given ip - it sends them back to the public ip accoring to the log above. however I don't know what's wrong. Any idea?
All the ip addresses are changed for security reasons of course.
best regards,
Uwe