Problems routing between clients in different subnets
Posted: Mon Aug 21, 2023 8:24 pm
Hi,
I've been searching for many hours to try and solve a problem I am facing, but with no luck.
I have an OpenVPN (CentOS 7) setup consisting of a VPN server and clients, some of which are in different subnets with access controlled using iptables. A Windows server also connects to the OpenVPN server, and users need to connect over their tunnels to it. I have tried various combinations of config file options but I am unable to add the correct client routes to get clients talking to each other. The client-to-client option is specified in server.conf.
The IP addressing is like so:
Users - 10.8.0.0/24
Admins 10.8.1.0/24 (specified in ccd files)
Server 10.8.2.1 (specified in it's ccd file)
The OpenVPN config is like so:
The server ccd file is like this:
The client file for the server that connects to the OpenVPN looks like this:
The frustrating thing is that I had this working previously but for reasons not worth going into, the config was lost.
I have found on the client above, if I manually add a route to 10.8.0.0/24 via 10.8.2.2 once the client connects, that it can ping 10.8.0.1 and other clients can connect to it. However if I do not add the route, it attempts to send traffic to 10.8.0.0 out of it's default gateway, which obviously fails.
At the moment I have worked around this by using a persistent static route, but I would dearly love to understand what I am doing wrong here. Many thanks in advance for any help!
I've been searching for many hours to try and solve a problem I am facing, but with no luck.
I have an OpenVPN (CentOS 7) setup consisting of a VPN server and clients, some of which are in different subnets with access controlled using iptables. A Windows server also connects to the OpenVPN server, and users need to connect over their tunnels to it. I have tried various combinations of config file options but I am unable to add the correct client routes to get clients talking to each other. The client-to-client option is specified in server.conf.
The IP addressing is like so:
Users - 10.8.0.0/24
Admins 10.8.1.0/24 (specified in ccd files)
Server 10.8.2.1 (specified in it's ccd file)
The OpenVPN config is like so:
Code: Select all
port 2000
proto tcp
dev tun0
user nobody
group nobody
persist-key
persist-tun
keepalive 10 120
topology subnet
client-to-client
server 10.8.0.0 255.255.0.0
route 10.8.1.0 255.255.255.0
route 10.8.2.0 255.255.255.0
ifconfig-pool-persist ipp.txt
#push "dhcp-option DNS 1.1.1.1"
#push "dhcp-option DNS 8.8.8.8"
#push "redirect-gateway def1 bypass-dhcp"
dh none
ecdh-curve prime256v1
tls-crypt tls-crypt.key
crl-verify crl.pem
ca ca.crt
cert server.crt
key server.key
auth SHA256
cipher AES-128-GCM
ncp-ciphers AES-128-GCM
tls-server
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
client-config-dir /etc/openvpn/ccd
status /var/log/openvpn/status.log
log-append /var/log/openvpn/openvpn.log
verb 3
Code: Select all
ifconfig-push 10.8.2.1 255.255.255.0
iroute 10.8.2.1 255.255.255.255
push "route 10.8.0.0 255.255.255.0"
push "route 10.8.1.0 255.255.255.0"
Code: Select all
client
proto tcp-client
remote X.X.X.X 2000
dev tun
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
verify-x509-name server name
auth SHA256
auth-nocache
cipher AES-128-GCM
tls-client
tls-version-min 1.2
tls-cipher TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
ignore-unknown-option block-outside-dns
setenv opt block-outside-dns # Prevent Windows 10 DNS leak
verb 3
I have found on the client above, if I manually add a route to 10.8.0.0/24 via 10.8.2.2 once the client connects, that it can ping 10.8.0.1 and other clients can connect to it. However if I do not add the route, it attempts to send traffic to 10.8.0.0 out of it's default gateway, which obviously fails.
At the moment I have worked around this by using a persistent static route, but I would dearly love to understand what I am doing wrong here. Many thanks in advance for any help!