Openvpn static ip


#1

I use openvpn (installed via PiVPN) to connect to my home network when out and about.

Is it possible to assign a static IP, either via Pi-Hole or openvpn, on a per devuce basis?
I’ve seen the client-config-dir option, but there seems to be multiple ways to implement this?
And, another thing to consider is, I setup the VPN a while back, so can’t recall exact options etc. I used.


#2

You’d need to add/configure that parameter.

client-config-dir /etc/openvpn/ccd

In that folder you’ll have to create files matching the name of the authorized client connecting to the VPN.

as in: If your user is Valiceemo, you would create the file Valiceemo in the ccd folder. Case sensitive.

Inside the file you will add:

ifconfig-push 10.8.0.2 255.255.255.0

(or whatever your ip range is)

Save,restart openvpn.
Every time Valiceemon authenticates, it will get the 10.8.0.2 IP.

If you do this for all the auth sessions (ovpn files or users) the same IP will be assigned to them.


#3

Thanks for this.
Done the above and it seems to work!

Added a host name to /etc/hosts and I can now track requests for whatever device I’m using! :+1::call_me_hand: