Hi guys,
This is my first time using openvpn and I can't seem to get the routing right. The client can ping the server and the server's LAN. The server can't access the client's LAN, but can ping the client's virtual interface (tun0), it can't ping the far interface of the client either (10.10.1.1). Also, although the client can ping all machines on the server's LAN, other machines on the client LAN can't ping even the virtual ip of the server.
The network looks like this:
10.100.1.0 --------10.100.3.0-----------10.10.1.0----------------10.10.1.10
Openvpn Virtual Net Client network 1 machine on client LAN
10.100.1.1, 10.10.1.1,
10.100.3.1 10.100.3.12
Routing table on server:
(Public IP) * 255.255.255.248 U 0 0 0 eth1
10.10.1.0 10.100.3.12 255.255.255.0 UG 0 0 0 tun0
10.100.1.0 * 255.255.255.0 U 0 0 0 eth0
10.100.3.0 * 255.255.255.0 U 0 0 0 tun0
default ( Public IP) 0.0.0.0 UG 0 0 0 eth1
Routing table on client 1 network gateway (10.10.1.1)
(Public IP) * 255.255.255.0 U 0 0 0 eth0
10.10.1.0 * 255.255.255.0 U 0 0 0 eth1
10.100.1.0 10.100.3.1 255.255.255.0 UG 0 0 0 tun0
10.100.3.0 * 255.255.255.0 U 0 0 0 tun0
default (Public IP) 0.0.0.0 UG 0 0 0 eth0
The relevant rules on iptables are:
Server iptables:
Chain INPUT (policy DROP)
pkts bytes target prot opt in out source destination
136 9000 ACCEPT all -- tun0 any anywhere anywhere
Chain FORWARD (policy ACCEPT)
pkts bytes target prot opt in out source destination
9 756 ACCEPT all -- any tun0 anywhere anywhere
Client iptables:
Chain INPUT (policy ACCEPT)
pkts bytes target prot opt in out source destination
154 12544 ACCEPT all -- tun0 any anywhere anywhere
Chain FORWARD (policy ACCEPT 43227 packets, 13M bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- any any 10.100.3.0/24 10.10.1.0/24
server ~]#ping 10.100.3.12
PING 10.100.3.12 (10.100.3.12) 56(84) bytes of data.
64 bytes from 10.100.3.12: icmp_seq=1 ttl=64 time=8197 ms
the 8197 ms isn't true, it's pinging much faster than that
server ~]#ping 10.10.1.1
PING 10.10.1.1 (10.10.1.1) 56(84) bytes of data.
client ~]# ping 10.100.3.1
PING 10.100.3.1 (10.100.3.1) 56(84) bytes of data.
64 bytes from 10.100.3.1: icmp_seq=1 ttl=64 time=18.1 ms
client ~]# ping 10.100.1.2
PING 10.100.1.2 (10.100.1.2) 56(84) bytes of data.
64 bytes from 10.100.1.2: icmp_seq=1 ttl=127 time=54.5 ms
The relevant config file of the server is as follows (running centos 5 final, rpm is openvpn-2.2.2-1.el5.rf)
local (Public IP)
port 1194 #- port
proto udp #- protocol
comp-lzo
ping 60
ping-restart 300
verb 3
log-append /var/log/openvpn.log
daemon
dev tun
persist-tun
topology subnet
ifconfig-pool-persist ip.txt
persist-key
server 10.100.3.0 255.255.255.0
route 10.10.1.0 255.255.255.0
route 10.100.2.0 255.255.255.0
push "route 10.100.1.0 255.255.255.0"
push "route 10.100.2.0 255.255.255.0"
client-to-client
The relevant config of the client is as follows (client is centos 6, rpm is openvpn-2.3.2-2.el6.i686):
client
dev tun
proto udp
remote ServerPublicIP 1194
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo
ping 60
ping-restart 300
verb 3
Thanks a million in advance.
Joaquin