Hi, this is a bit more complicated, at least for me. I hope others are more fit on OpenVPN than I am?
My setup on the server is this:
172.16.0.0/13 should be reachable nets
172.24.0.0/13 are VPN subnets, BUT:
- depending on which client connects, I want that client to get an IP from a specific subnet. All I found so far is using the "ccd" dir to give an IP via "ifconfig" to each client.
- clients are grouped in /24 subnets, so my firewall setup is easier
- clients only get access to one /24 subnet of 172.16.0.0/13, so I need a "push" command in ccd as well
Example:
Client A should get an IP from 172.24.0.0/24, and access to 172.16.0.0/24
Client B should get an IP from 172.24.1.0/24, and access to 172.16.1.0/24
Client C should get an IP from 172.24.2.0/24, and access to 172.16.2.0/24
Now I have the "ccd" files like this:
ccd/A:
ifconfig-push 172.24.0.9 172.24.0.10
push "route 172.16.0.0 255.255.255.0 vpn_gateway"
(you can guess the files for client B and C I guess)
The problems:
- The client does NOT set the route to 172.16.0.0, as "Warning: route gateway is not reachable on any active network adapters: <gateway>". I've tried with the <gateway> IPs of 172.24.0.9, 172.24.0.10, 172.24.0.1. Nothing works. Route does not get set.
- Is it not possible to say in ccd "give this client an IP of range 172.24.0.0/24"? That would be nice for easier manageability. Something like "ifconfig-push 172.24.0.0/24".
- why is it not sufficient to say
push "route 172.16.0.0 255.255.255.0"
on the client and it gets it's VPN gateway IP itself? Maybe my "server" statement is wrong?
Here are the relevant bits of the SERVER config:
dev tun
tls-server (with all keys etc. - this works)
topology subnet
server 172.24.0.0 255.248.0.0 (I patched pool.h so this works)
ifconfig-pool-persist ipp.txt
client-config-dir ccd-cust
(then follow the usual keepalive etc. but this all works)
The CLIENT.OVPN looks like this:
cert A.crt
key A.key (per client keys permit the use of ccd)
client
dev tun
tls-client (along with all certs)
remote SERVER <port> udp