I am struggling with a specific OpenVPN scenario for a few months now. Researching on Google, reading on Serverfault, browsing Blogs and other forums, messing with my config time and time again. I am not sure anymore, if my requirements even logically work.
Here the scenario:
I have a rented Root-Server, which I use for several services, cloud-storage, backups, etc. To keep it simple, let's call the elements Client1 and Client2 and Server1.
Server1 is using the tun-Device.
- Client1 Physical Network: 192.168.1.0/24
- Client2 Physical Network: 192.168.178.0/24
- Client1 Physical IP: 192.168.1.4
Client2 Physical IP: 192.168.178.22
Server1 Virtual Network: 192.168.2.0/24
- Server1 VPN-IP: 192.168.2.1
- Client1 VPN-IP: 192.168.2.6
- Client2 VPN-IP: 192.168.2.10
Both clients can connect to the VPN-Server and use it's services without problems. Both Clients can ping the servers VPN-IP successfully. Server1 can't ping the clients VPN-IP's. Both Clients can't ping each others VPN-IP.
I want to connect both clients so that they can communicate as in a physical LAN, but fail to do so.
Here are my configurations.
Server config:
port 1195
proto tcp-server
dev tun1
ca keys/server1/ca.crt
cert keys/server1/openvpn-server.crt
key keys/server1/openvpn-server.key
dh keys/server1/dh4096.pem
server 192.168.2.0 255.255.255.0
crl-verify keys/server1/crl.pem
ifconfig-pool-persist servers/server1/logs/ipp.txt
cipher AES-256-CBC
user nobody
group nogroup
status servers/server1/logs/openvpn-status.log
log-append servers/server1/logs/openvpn.log
verb 2
mute 20
max-clients 100
local XXX.XXX.XXX.245
management 127.0.0.1 8877
keepalive 10 120
client-config-dir /etc/openvpn/servers/server1/ccd
client-to-client
comp-lzo
persist-key
persist-tun
ccd-exclusive
push "redirect-gateway def1"
push "dhcp-option DNS XXX.XXX.XXX.98"
push "route 192.168.2.0 255.255.255.0"
Client1 config:
client
proto tcp-client
dev tun
ca ca.crt
dh dh4096.pem
cert user1.crt
key user1.key
remote XXX.XXX.XXX.245 1195
cipher AES-256-CBC
verb 2
mute 20
keepalive 10 120
comp-lzo
persist-key
persist-tun
float
resolv-retry infinite
nobind
push "route-gateway 192.168.2.1"
Client2's config is, besides the certificates, exactly the same.
On the server /etc/sysctl.conf contains the entry net.ipv4.ip_forward=1 Client-Firewalls have been adjusted to let OpenVPN pass through. IP-Forwarding is activated on both Clients per IPEnableRouter registry-switch.
IP-Tables has only one specific extra rule, to enable access to the Internet.
iptables -t nat -A POSTROUTING -o eth0 -s 192.168.2.0/24 -j SNAT --to XXX.XXX.XXX.245
Most FAQ's, tutorials or Blog Posts talk about connecting clients of multiple different VPN's. I would like to have my clients in the same VPN. I am at my wits end, I can't get the clients to even ping each other. Is this even possible, or have I completely misunderstood the concept of VPN?
I would appreciate every hint you can give me, to solve this self-created problem.
Edit: Traceroute Client1 -> Server1
traceroute to 192.168.2.1 (192.168.2.1), 30 hops max, 60 byte packets
1 19 ms 18 ms 18 ms 192.168.2.1
Traceroute Client1 -> Client2
traceroute to 192.168.2.10 (192.168.2.10), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
Traceroute Server1 to Client1 results in the same as Client1 to Client2