OpenVPN and static IP on client

I have OpenVPN server running on an AR750, and clients connecting (as default, with dynamic IPs).
I’d need static IPs on client.

Any suggestions?

Hi
Server config add
ifconfig-push 10.8.0.5 10.8.0.6

where? in server.ovpn?

Hi
Please refer to the following link, I am also testing

Did you succeed? I tried but nothing…

Hi
I had successed

First find the CN name that generated the certificate

/usr/bin/cert_manager

Client certificate

openssl req -nodes -days 3650 -newkey rsa:2048 -outform PEM -out \

       $CLIENT_CSR -keyout $CLIENT_KEY -sha1 -subj '/CN=**OpenVpn_client**' >/dev/null 2>&1

Modify ovpn server configuration

  1. The directory /etc/openvpn increases the ccd directory and stores the client IP.
    mkdir -p /etc/openvpn/ccd

  2. Create a file in the /etc/openvpn/ccd directory. The file name must be exactly the same as CN.
    touch /etc/openvpn/ccd/OpenVpn_client

  3. Enter the following in OpenVpn_client
    echo “ifconfig-push 10.8.0.5 255.255.255.0” >/etc/openvpn/ccd/OpenVpn_client

Remarks:

10.8.0.5 is the static IP to be assigned by the client.

Modify the /etc/openvpn/server.conf configuration file
The content is as follows
#route-gateway dhcp
#duplicate-cn
client-config-dir /etc/openvpn/ccd

Just to help others, in Glinet routers the server.conf file has the ovpn extension and is located in /etc/openvpn/ovpn directory …

A note of caution… acording to the manual, disabling the duplicate-cn option makes the server kick out the former connected clients with the same name once a new one tries to connect… sometimes several clients share the same standard name and this may be an issue:
" –duplicate-cn
Allow multiple clients with the same common name to concurrently connect. In the absence of this option, OpenVPN will disconnect a client instance upon connection of a new client having the same common name."