Page 1 of 1

Moving openvpn server - can it autodetect its LAN?

Posted: Sun Oct 08, 2023 1:20 pm
by BobAGI
Situation:
OpenVPN server (2.5.1) installed and running on a RaspberryPi device.
Server shut down and moved to another location and started there.

Since the new location uses a different LAN IP range, can the server.conf be configured such that the server will auto-detect the new IP range and adjust its setting accordingly?
I have already added the multihome directive so it can use either the wlan0 or eth0 network interfaces. But those are on the same network so that does not help much.

There is a setting in the conf file that deals with the redirection of clients toward the OpenVPN server's LAN and out to the Internet this way:

Code: Select all

push "route 192.168.119.0 255.255.255.0" #Gives access to Local LAN
When it is moved to another LAN like 10.132.55.0/24 then one has to go in (as root) and edit the server.conf file to make it work....

So can it be told to push whichever LAN it is currently running on? Instead of having to enter the numeric LAN address into the file.
Or can this particular line be read from a file on startup so I can script its modification on system startup (before OpenVPN starts)?