User Tools

Site Tools


OpenVPN client using LuCI


  • This guide describes how install and operate the OpenVPN client using LuCI web interface.
  • You can use it to connect to your own OpenVPN server or a commercial OpenVPN provider.
  • Follow OpenVPN basic for server setup and OpenVPN extras for additional tuning.
  • The performance of different SoCs can be found here OpenVPN performance.


  • Encrypt your internet connection to enforce security and privacy.
    • Prevent data leak and traffic spoofing on the client side.
  • Bypass regional restrictions using commercial providers.
    • Escape client side content filters and internet censorship.
  • Access your LAN services remotely without port forwarding.


1. Install needed packages

Install openvpn-openssl and luci-app-openvpn to be able to manage OpenVPN using web interface.

A new page in the LuCI web interface should appear.

Navigate to LuCI → VPN → OpenVPN to open the OpenVPN config managment page.

2.a Write the configuration manually to create a config file

Create a new config with the Template-based configuration line by choosing the template, writing a name and clicking Add button to create it.

Then it will appear in the table and you can edit this configuration file by clicking on Edit button to open the edit page for this configuration.

2.b Upload a OpenVPN config file

This is available from OpenWrt 19.07 onwards.

All self-respecting commercial OpenVPN providers will offer self-sufficient OpenVPN config files you can load in your consumer router or network appliance to connect to their service.

You can use them in OpenWrt too.

Use the OVPN configuration file upload to give a name and upload one of such config files.

It will appear in the table of available OpenVPN configurations.

If your provider requires you to write your username and a password, click on the Edit button, and in the edit page, write your username and password in the second text box, as shown in this example

Now edit the line beginning auth-user-pass in the first text box to included the full path to the username/password .auth file. The full path is visible just above the second text box. For above example:

auth-user-pass /etc/openvpn/NLMiramUDP443E3.auth

3. Start and enable the client

Start the client by pressing on the Start button in the table of available configurations. OpenVPN startup and shutdown are slow, it can take up to 10 seconds to complete.

If you want this VPN client connection to be started on boot and always active, click in the Enable checkbox of its line in the table.

Note: If clicking on Start button in the table does not start the VPN instance. Tick the Enable checkbox, and press Save & Apply button to start the VPN instance

4. Firewall

At this point the VPN is set up and the router can use it, but devices in the LAN of your router won't be able to access the internet anymore.

We need to set the VPN network interface as public by assigning VPN interface to WAN zone.

4.1-a With Openwrt up to 18.06 and 19.07

  1. Click on Network in the top bar and then on Interfaces to open the interfaces configuration page.
  2. Click on button Add new Interface…
  3. Fill the form with the following values: name = tun0, Protocole = Unmanaged, Interface = tun0. Then click on Create Interface.
  4. Edit the interface.
  5. In panel General Settings: unselect the checkbox Bring up on boot.
  6. In panel Firewall Settings: Assign firewall-zone to wan.
  7. Click on Save and Apply the new configuration.
  8. Reboot the router.

4.1-b With Openwrt 19.07 (alternative to the above step 4.1)

Click on Network in the top bar and then on Firewall to open the firewall configuration page.

Click on the Edit button of the wan (red) zone in the Zones list at the bottom of the page.

Click on the Advanced Settings tab and select the tunX interface (tun0 in the screenshot, which is the most likely if you have a single OpenVPN client/server running)

You can see the interface name if you click on Status on the top bar and then click on System Log.

A few lines from the system log where you can see the interface name of the OpenVPN client started with the configuration file NLMiramUDP443E3

 Fri Aug 30 11:28:32 2019 daemon.notice openvpn(NLMiramUDP443E3)[7993]: TUN/TAP device tun0 opened
 Fri Aug 30 11:28:32 2019 daemon.notice openvpn(NLMiramUDP443E3)[7993]: TUN/TAP TX queue length set to 100
 Fri Aug 30 11:28:32 2019 daemon.notice openvpn(NLMiramUDP443E3)[7993]: /sbin/ifconfig tun0 netmask mtu 1500 broadcast

5. Test that all is working

Establish the VPN connection. Verify your client traffic is routed via VPN gateway.


Check your client public IP addresses.

Make sure there is no DNS leak on the client side.

Delegate a public IPv6 prefix to VPN6 network to use IPv6 by default.


If you discover DNS is not working, use LuCI and navigate to Network → Interfaces → LAN, disable peer DNS and specify your preferred DNS servers in the Use Custom DNS field, e.g. and for Google DNS.

Open a ssh remote terminal connection to the router.

Collect and analyze the following information.

# Restart services
/etc/init.d/log restart; /etc/init.d/openvpn restart; sleep 10
# Log and status
logread -e openvpn; netstat -l -n -p | grep -e openvpn
# Runtime configuration
pgrep -f -a openvpn
ip address show; ip route show table all
ip rule show; ip -6 rule show; iptables-save; ip6tables-save
# Persistent configuration
uci show network; uci show firewall; uci show openvpn
head -n -0 /etc/openvpn/*.conf

Alternative guide for OpenVPN client using LuCI

The link below is to a tutorial which was written for the BT Home Hub 5A and Windows Users in mind, but is sufficiently generic to apply to most other OpenWrt routers with a working internet connection. It has been tested with Asus RT-AC57u, Linksys EA6350v3, TPlink Archer C50 v4, Western Digital MyNet N750 etc.

The original v1.1 guide supports LEDE 17 and OpenWrt 18. The later v1.2 guide is for OpenWrt 19.07 using its new ovpn file upload function. Includes information on DNS resolver, Kill switch, and popular VPN providers.

If you are having difficulties getting openvpn client to work using the instructions contained on this wiki page, please download and study the tutorial PDF from the Dropbox folder found in the ebilan forum.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/guide-user/services/vpn/openvpn/client-luci.txt · Last modified: 2020/10/18 05:34 by vgaetera