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."

hello everyone!I have done everything but it does not take me in any way the ip assigned to the users put in the /etc/openvpn/ccd/ folder and yet I put in server.ovpn the following path client-config-dir /etc/openvpn/ccd.

Frankly, I didn’t understand the first part of the guide that talks Client certificate
openssl req -nodes -days 3650 -newkey rsa:2048 -outform PEM -out \ …

what needs to be done?In the text OpenVPN Assign static IP to client | It's full of stars! doesn’t part of anything.

Clients connect to me correctly but dhcp seems to keep working even though I commented #route-gateway dhcp

Can you help me !!!Thank you!!!

I have also tried removing the server.ovpn file and restarting the openvpn service from the router management panel and it works pulling up my vpn in dhcp as if nothing happened!I don’t understand it doesn’t seem to take any changes and yet I connected in ssh with the root user

I switched to wireguard.
Wonderful stable vpn with static IP

thanks for your advice only that on qnap ts431 and synology there is no client and therefore it is a problem for me

I used to do this back in the day when I used my AR750 Slate as a client to connect to my NetGear Router VPN server. I added the static IP address and gateway to the client config file before importing the file into the AR750 router’s client config.

route-gateway 192.168.0.1
ifconfig 192.168.0.254 255.255.255.0

So for GL.iNet as the OpenVPN server, this might work.

route-gateway 10.8.0.1
ifconfig 10.8.0.254 255.255.255.0

thanks I’ll try to see if it works and I’ll update you thanks again!