Back to Guides

DD-WRT routers and Mullvad VPN

What is DD-WRT?

As stated on dd-wrt.com, DD-WRT is a Linux-based, alternative open-source firmware suitable for a wide variety of WLAN routers and embedded systems. The main emphasis is to provide the easiest-possible handling while at the same time supporting a great number of functionalities within the framework of the respective hardware platform used.

DD-WRT has support for OpenVPN and can be used to connect to the Mullvad VPN servers.

Installing DD-WRT on your router

You can check online if your router is supported and then download DD-WRT.

Installing OpenVPN and Mullvad on your router comes with some benefits:

  • You can secure your whole network and all devices connected to the router.
  • You can run Mullvad on more than three devices (all devices connected to the router).
  • Via the router, you can even run Mullvad on devices that have no support for OpenVPN.
  • A router is designed for routing, naturally, and is not disturbed by other programs and settings like a program in a computer might be. It works well and is stable.

Expected performance of OpenVPN on a router

Running OpenVPN on a router is demanding. On a router with a 400mhz ARM CPU, you can expect performance around 7–10Mbps. It scales relatively linearly, so on a router with 1.6Ghz ARM CPU we would expect performance around 30–40Mbps.

For other speed-related questions, please read our Speed Guide. Also keep in mind that OpenVPN itself does not use multiple cores and that x86 CPUs will perform a lot better.

Before you set up OpenVPN

A DD-WRT router's default IP address is normally 192.168.1.1. Sometimes this address is in conflict with other routers and you might have to change it. If so, try 192.168.10.1, but remember to change the default address everywhere that it is mentioned in this guide.

The first time you connect, you will be prompted to replace the admin login usernamn and password with your own.

Setting up Mullvad VPN

Follow the instructions below (please read through once before starting).

VPN tab

Click on the tab Services and then the subtab VPN. This is where you will set up the Mullvad VPN.

OpenVPN: Enable

Next to Start OpenVPN Client, choose Enable. 

Server IP/Name

Next to Server IP/Name, specify your preferred exit country by entering the corresponding server IP. For example:

  • se.mullvad.net (Sweden)
  • nl.mullvad.net (Netherlands).

For a list of all options, please look at our list of severs.

Port

Change to "1300".

Encryption Algorithm

Change to "AES-256 CBC".

Hash Algorithm

Change to "SHA1".

Enable advanced options

Next to Advanced Options, check "Enable".

LZO Compression

Change to "Yes".

NAT

Change to "Enable"

nsCertType verification

Check the box.

Additional Config

Enable Advanced Options in order to:

Under Additional Config, enter the following text:

tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA
verb 4

The "verb 4" text is optional and is used for more detailed logging to help with problem solving.

Download your configuration files

On Mullvad's OpenVPN configuration download webpage, enter your Mullvad account number and log in.

Download and unzip the mullvadconfig.zip file. In the unzipped folder, you will find another folder named with your Mullvad account number and containing the files ca.crt, mullvad.crt, and mullvad.key.

CA Cert

Open the ca.crt file in a text editor. At the end of the file, find the two long text strings that both begin with "-----BEGIN CERTIFICATE-----" and end with "-----END CERTIFICATE-----".

Copy the second one, starting from and including "----- BEGIN" all the way through and including" END CERTIFICATE-----". Paste this text string into the CA Cert field.

Public Client Cert

Open the mullvad.crt file in a text editor. Copy the text string from and including "----- BEGIN CERTIFICATE" all the way through and including " END CERTIFICATE-----". Paste this into the Public Client Cert field.

Private Client Key

Open the mullvad.key file in a text editor. Copy the entire contents and paste it into the Private Client Key field.

Please note that the most common error in this installation is to copy the wrong part of these files into the fields above. Make sure this is correct.

Apply Settings

Click on the Apply Settings button.

Enable IPv6

Click on the tab Setup and then the subtab IPV6. Next to IPv6, click Enable. Mullvad will not function without this.

Set the DNS

Now you will set the DNS to Mullvad's DNS. This will ensure that information is not leaked to the provider running the local network and will therefore keep them from seeing which domain names are looked up.

Basic Setup tab

Click on the tab Setup and then the subtab Basic Setup.

Static DNS 1

Next to Static DNS 1, change the four fields so that the string reads 10.8.0.1.

Apply

Click on the Apply Settings button.

Add a kill switch

Next, you will add the following firewall settings in order to disable all network access outside of the VPN tunnel.

Start IP Address and Maximum DHCP Users

While still on the Basic Setup page, take note of the input for Start IP Address and Maximum DHCP Users. You will need this information for the following steps.

In the example below, Start IP Address is 192.168.1.100 and Maximum DHCP Users is 50. This information tells you the range of IPs used by the DHCP server on your router, in this instance from 192.168.1.100 to 192.168.1.150.

Commands

Click on the tab Administration and then the subtab Commands.

In the Commands field, enter the following text and adjust the range according to the input from your router as mentioned above:

iptables -I FORWARD ! -o tun1 -m iprange --src-range 192.168.1.100-192.168.1.150 -j DROP

Save Firewall

Click on the Save Firewall button.

Keep Alive function

The following settings will ping the Mullvad DNS every six minutes (360 seconds) and restart the router if the connection goes down. Since the DNS is available only via the VPN tunnel, the router will restart if the tunnel stops working.

You might consider testing your VPN tunnel before implementing the Keep Alive settings because if something isn't working, a router that reboots every six minutes can get annoying.

Keep Alive tab

Click on the tab Administration and then the subtab Keep Alive.

Use these settings

Adjust your settings to match the ones in the picture below.

Apply Settings

Click on the Apply Settings button.

Secure your WiFi

Wireless Security tab

Click on the tab Wireless and then the subtab Wireless Security.

Encryption and password

By default, the WiFi is unprotected on DD-WRT. You need to set Security Mode to WPA2 Personal, change algorithm to AES and select a strong password in the box WPA Shared Key.
Some routers have several WiFi networks; make sure you secure all of them.

Test your IP address

Use a service like Whoer to see which IP adress you are using. It should be one of Mullvad's and not your own.

Troubleshooting

Try the following:

  • Look at the OpenVPN logs under Status » OpenVPN.
  • Assign a different IP address to your router (in case of conflict with other devices) under Setup » Basic Setup.
  • Check that you correctly followed all of the instructions.
  • Restart the router.