[SOLVED] Issues configuring openvpn on OpenWrt 18.06.1

Hi,
these are the version details:
OpenWrt 18.06.1 r7258-5eb055306f Powered by LuCI openwrt-18.06 branch (git-18.228.31946-f64b152)

  • I know, I should upgrade. I can't, without bringing down the whole network - it's remote (hundreds of miles)...impossible.

The issue(s):
I have an usual openvpn server running on OpenWRT and I'd like to be able to allocate for each VPN user a static IP. When it comes to just a few users I go for multiple PtP openvpn instances, tried that on OpenWRT 15 and failed (thread was opened in the old forum).
With this usual openvpn server on 18.06, my only options to get my clients on fixed IPs are:

  1. To make use of the client-config-dir directive and add a file in the config dir for each client containing something like ifconfig-push 10.8.1.1 10.8.1.2
    Tried this and failed (actually I don't know who failed, me, OpenWRT, LuCI, openvpn).
  2. Use ifconfig-pool-persist file [seconds] , define the IPs for each user in the file and set the seconds on 0.
    I'm stuck at how to do this, because if I add the option through LuCI, I fail - actually LuCi does.
    If I add it manually in /etc/config/openvpn, LuCi won't recognize my configuration anymore.
    Last thing I tried was:

uci set openvpn.router-name.ifconfig_pool_persist=/etc/openvpn/ipp.txt 0

Usage: uci [] []
....and all the usage help...

What is the correct syntax for the above uci set line? I copied it from what LuCI generated and failed (LuCI failed!)
Please note that I cannot play with that system, already had to connect through TeamViewer and reload the backup configuration twice.

Thank you in advance!

This is not the correct syntax.
https://openwrt.org/docs/guide-user/services/vpn/openvpn/extra#static_addresses

Thanks! Whatever I tried to put as "correct syntax", the option server '10.0.0.0 255.255.255.0 from /etc/config/openvpn was not overridden, I still got a random IP from the pool above.

I'd like to focus on the second solution, looks simpler and I'm only stuck with the syntax, defining two parameters for ifconfig_pool_persist

Try it this way
uci set openvpn.test.ifconfig_pool_persist='/etc/openvpn/ipp.txt 0'

1 Like

uci set openvpn.test.ifconfig_pool_persist='/etc/openvpn/ipp.txt 0'
uci: Invalid argument

Actually it did work, I only needed to substitute "test" with the actual name of the openvpn server.

Thank you! Problem solved! Now I get exactly the IP that I defined in /etc/openvpn/ipp.txt
(don't know why I haven't considered using ' ... ')

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.