In this article, you will learn how to configure a Surfshark OpenVPN tunnel on your OpenWRT router through the router's web interface.
Note: If you prefer to set it up via the terminal instead, check out our guide on how to set up OpenVPN on an OpenWRT router.
Credentials and server selection
Before configuring your router, you will need to generate your manual setup credentials and download a server configuration file.
NOTE: These are not your regular Surfshark account credentials (your email address and password).
-
Head to the Surfshark login page and sign in. Then, go to VPN > Manual setup.
-
Select Set up manually.
-
Choose the OpenVPN protocol.
-
Make sure you are in the Credentials tab and click Generate credentials.
NOTE: Keep this tab open or save your username and password, as you will need them later.
Choose a Surfshark VPN server
-
Switch to the Locations tab and find the server you want to connect to.
-
Click the download icon to the right of the server name.
-
Click Download UDP and save the
.ovpnfile to your device.
NOTE: In this guide, we use UDP, though you can also use TCP. Learn more about the differences between TCP and UDP.
Configuring the OpenVPN client
Sign in to the OpenWRT web interface
-
Open your browser and enter your OpenWRT router's local IP address into the address bar. By default, this is 192.168.1.1.
-
Sign in with your router's administrator account. By default, the username is root.
If this is your first time signing in, no password is set. You can set an administrator password under System > Administration.
Install the required OpenVPN packages
-
In the top menu, go to System > Software.
-
Click Update lists and wait for the package list to finish updating. Once done, click Dismiss.
-
Use the Filter field to search for and install the following two packages one by one (click Install... next to each):
- openvpn-openssl
- luci-app-openvpn
Upload the server configuration file
-
Refresh your browser page so the new VPN tab appears in the top navigation menu.
-
Go to VPN > OpenVPN.
-
Under the OVPN configuration file upload section, enter a name for your connection in the Instance name field (for example, surfshark_uk_lon).
-
Click Browse (or Choose File), select the Surfshark
.ovpnconfiguration file you downloaded earlier, and click Upload.
Add your Surfshark credentials
-
In the OpenVPN instances list, click Edit next to the instance you just created.
-
Scroll down to the second text box at the bottom of the page (labeled Section to add an optional 'auth-user-pass' file with your details).
-
Enter your Surfshark manual setup username on the first line and your password on the second line.
-
Copy the credentials file path shown directly above that box (for example,
/etc/openvpn/surfshark_uk_lon.auth).
-
In the top Config file text box, locate the
auth-user-passline and paste the file path next to it so it reads:auth-user-pass /etc/openvpn/surfshark_uk_lon.auth
-
Click Save.
Create the VPN interface
-
Go to Network > Interfaces and click Add new interface...
-
Name the interface surfsharktun.
-
Set Protocol to Unmanaged.
-
Open the Interface dropdown menu (labeled Device on newer OpenWRT versions), select the -- custom -- field at the bottom, type tun0, and press Enter.
-
Click Create interface, then click Save (and Save & Apply if prompted).
Configure the firewall
-
Go to Network > Firewall and click Add under the Zones section.
-
Configure the new firewall zone with the following settings:
- Name: vpnfirewall
- Input: Reject
- Output: Accept
- Forward: Reject
- Masquerading: Checked (enabled)
- MSS clamping: Checked (enabled)
- Covered Networks: Select surfsharktun
-
Allow forward from source zones: Select lan
-
Click Save.
-
Back in the Zones list, find the zone named lan and click Edit.
-
Step 5: Under Allow forward to destination zones, check vpnfirewall, click Save, and then click Save & Apply at the bottom of the Firewall page.
Set Surfshark DNS addresses
-
Go to Network > DHCP and DNS.
-
In the General Settings tab, find DNS forwarding and add both Surfshark DNS addresses:
- 162.252.172.57
-
149.154.159.92
-
Switch to the Resolv and Hosts Files tab, check the Ignore resolve file checkbox, and click Save & Apply.
Enable and start the VPN connection
-
Go back to VPN > OpenVPN.
-
In the OpenVPN instances section, check the Enable box next to your Surfshark instance and click Save & Apply.
- Click Start next to the Surfshark instance to connect. Whenever you want to disconnect, click Stop.
Make sure your connection is successful
It's always recommended to check whether your connection was successful after setting up a VPN for the first time. You can easily verify this by running an IP leak test and a DNS leak test on our website.
You may also be interested in: