Selectively routing Plex through your VPN

Plex’s all-in-one streaming and easy setup has made it the media server of choice for a lot of users, but having all of your movies and music in one place doesn’t mean much if you can’t connect.

Private and encrypted connections are more popular than ever, but if your Plex server gets on the web through a VPN, you won’t be able to access it through the layers of security.

Here’s everything you need in order to get your Plex server streaming through your VPN without sacrificing any protection.

Getting started routing Plex through your VPN

It takes a few steps to get Plex streaming over a VPN. Here’s what you can expect:

Give your Plex server a static IP address

Make a note of a few Plex settings

Enable port forwarding in your router

Configure your VPN to allow unrestricted access to plex.tv

After that, you can seamlessly connect to your private Plex server from anywhere in the world using the app or a web browser, regardless of how secure your home internet connection is.

This whole process is called selective routing, and it’s a powerful networking tool to know. If you want to know which VPN we recommend we’ll cover this a little later in the article.

Setting up Plex server

There are a few things you’ll need to do before you get started making changes to your network. Please note that all of these steps should take place on your Plex streaming media server.

Give your Plex server a static IP address

If you haven’t done so already, make sure to give your Plex server a static IP address. This will let you setup port forwarding properly, and ensure that any changes you make to the VPN configuration or your router will continue to work after a reboot.

To set a static IP address, first open the Control Panel.

Then click View network status and tasks in the Network and Internet category.

Finally, select a static IP address for your Plex server, fill out the gateway and DNS information, and click the OK button. Take note of the IP address, you’ll need it later to setup your VPN.

Note that a good static IP address will be outside of your router’s DHCP range. In this case, my router hands out addresses from 192.168.1.150 to 192.168.1.254, so choosing 192.168.1.100 is safe.

When a router assigns an IP address that’s already in use on the network, it causes a conflict, so double-check your router’s DHCP settings before you assign a static address.

When choosing static DNS servers, it’s a good idea to use a mix. In this configuration, I use my router first, 192.168.1.1, which forwards DNS lookups to my internet service provider. As a backup, I chose a free and secure Google server at 8.8.4.4 or 8.8.8.8

You’re finished setting a static IP.

Make a note of your Plex settings

Before you configure your VPN to pass Plex traffic directly to your server, you’ll need to connect to Plex through the web interface in order to confirm your settings.

The Plex web client is accessible through this link, or by right-clicking the tray icon and selecting the Open Plex… menu item.

Once the console is open, click the Settings link on the left sidebar.

Click Remote Access on the left sidebar.

Make a note of the port that Plex uses for remote access so that you can use it, along with your static IP address, to setup your router in the next step. In most cases, this will be port 32400.

Now that your Plex server has a static IP address, OpenVPN has been installed, and you’re sure of the proper port settings, you can move on to setting up your local network.

Setting up your local network

The next step is to tell your router where to send incoming Plex connections. In this case, it will be to the static IP address of your Plex server.

Enable port forwarding in your router

First, connect to the web interface of your router. This link or this link will work for the majority of readers. You’ll need to login with the proper username and password.

Once you have logged in to your router, you’ll need to find the settings for port forwarding. In this Linksys router, it’s found under Security on the left sidebar, then on the Apps and Gaming tab. Your router may be different.

After finding the port forwarding settings for your router, fill it out with your Plex server information.

Application Name is meaningless, and only makes it easy to identify which application we’re working with. You can set it to anything, but Plex makes sense.

External Port tells the router exactly where to look for Plex traffic on the internet. It can be set to anything aside from a handful of reserved numbers. It’s convenient to use 32401.

Internal Port tells the router exactly where to send Plex traffic on the LAN. You made a note of this port while setting up the Plex server. The default is 32400.

Protocol dictates what kind of traffic is allowed to be forwarded. Set it to ‘TCP’ or ‘Both,’ but only TCP is needed.

Device IP specifies your Plex server’s static IP address. You made a note of this number while setting up your Plex server.

The Enabled check box allows you to turn port forwarding for Plex on and off. Make sure it’s on.

When you’re finished, click the OK button and exit the web interface for your router.

Setting up your VPN

Now that the router has been set to forward the proper port, you can configure your VPN.IPVanish is a paid VPN service with with server locations all over the world.

We strongly recommend it for anyone who needs to be able to browse the web anonymously, and do it without slowdowns or complicated config files associated with many VPNs. IPVanish is one of the few VPNs that doesn’t keep any form of log files so your activity is truly private and you won’t have to worry about your ISP or others spying on your online activity.

If you have config files for another VPN server, you can connect using OpenVPN. We’ll show you how to set up Plex over VPN using both IPVanish and OpenVPN.

Install and configure IPVanish

IPVanish is much easier then OpenVPN to install and configure.

If it’s already installed on your Plex server, you can skip over the installation guide and download Comparitech’s edited version of IPVanish.config right here. Just make sure to save it to the proper place, usually C:\Program Files\IPVanish\OpenVPN\To install IPVanish, visit this link and click the Download Now button. You will have to be logged in to your account in order to download the IPVanish installation.

Take note of the path, because you’ll need to edit a configuration file where you choose to install IPVanish. The default path in Windows is C:\Program Files\IPVanish and that’s where you should install it.

Next, your computer will need to be restarted after installing IPVanish.

After restarting your computer, open an explorer window to the path that you installed IPVanish. If you’re following along step-by-step, it will be C:\Program Files\IPVanish and you’ll need to locate the OpenVPN directory in order to edit a file.

Now, open up the OpenVPN directory and right-click on IPVanish.config and then select the Open menu item.

You’ll need to tell Windows to open IPVanish.config using Notepad.

Once IPVanish.config is open for editing, add route plex.tv 255.255.255.0 192.168.1.1 to the end of the config file, then save your changes.

Then start IPVanish using the shortcut on your desktop, and connect to a VPN server as usual. The script that you saved in your IPVanish.config file will tell your VPN connection to ignore Plex traffic and route it as usual.

If you’re using IPVanish as your VPN provider, you can skip to the final step.

Install and configure OpenVPN

Installing OpenVPN is pretty straightforward. You’ll want to download the Windows installer here. Skip this section if you’re using IPVanish or another VPN provider’s app.

Make sure you get the OpenVPN Windows installer from the website, and not the source code.

After downloading, open up the file and give it permission to run. The install wizard will start, and it’s fine to click through using the default options. When the OpenVPN installer is done, click Finish and move on to the next step.

Once OpenVPN is installed, you can set it up. The process can be complicated, so we’ve pre-made a secure configuration file to be imported and used right away. It will automatically connect you to a free OpenVPN tunnel in the United States.

Our OpenVPN configuration file can be downloaded here. If necessary, the configuration file can be edited in Notepad. Once you’ve downloaded the configuration file, you need to make a few quick changes to OpenVPN and then you can import it.

Look for the OpenVPN icon in the system tray.

Right-click on the icon and select the Settings… menu item.

Then, click on the Advanced tab.

Next, check the Service only box, and click the OK button to exit.

Right-click the tray icon again, but this time select the Import file… menu item.

Then select the Comparitech configuration file you just downloaded, and press the Open button to import it.

You’ll see this message when the file has been imported successfully.

Now, right-click the OpenVPN tray icon again, and this time select the Connect menu item.

Then a message will appear and tell you that you’ve established a VPN tunnel and your public IP address has changed.The tray icon will also turn green when you’re connected successfully.

Setting up your mobile device

The best part about this method is that there’s absolutely no setup to do on your device. Your Plex server will be able to browse the rest of the internet anonymously but, when it comes to streaming media, things will work as usual.

Now each and every Plex client — whether it’s an Android tablet, an iPhone, XBox, Smart TV, or streaming stick — can now connect seamlessly to your server, even if you use a VPN.

9 thoughts on “Selectively routing Plex through your VPN”

Thanks for your article, great stuff. Just one simple question if I start using IPVanish with the workaround in the config file as described. Is traffic going to plex.tv still secured and connected over the VPN with the exception in the config file?

Hi John, thanks for reading. The answer to your question is yes and no. The traffic to plex.tv is secure and encrypted because it goes out over HTTPS, but it is not going through your VPN. The rule that is added to the config file tells IPVanish to allow your computer to connect directly to plex.tv.

There are a few reasons why I recommend doing things this way, but the biggest one is speed. Streaming videos takes a lot of bandwidth, and encrypting big streams takes tons of processing power. Encrypting a 10Mbps 1080p stream with standard 2048-bit RSA encryption is going to be difficult unless you have an expensive processor. It’s also redundant, since we’re already using SSL over HTTPS.

Thanks for posting such a great article!Without getting into details or preferred VPN’s. I currently use ExpressVPN, but I’m not sure about the config file. There is an option in the app to allow/deny some or all apps. Is this VPN sufficient for my Plex server or would you recommend changing to something else?

You absolutely should allow the Plex app, but it won’t solve the entire problem. You’ll also need to manually add a route for plex.tv in your config file. You’ll probably need to search their site for info on how to edit ExpressVPN config files.

I haven’t heard anything bad about ExpressVPN, but I think it’s too hard to work with sometimes. We like IPVanish better. It uses a single, master IPVanish.config file, so you can add a static route like this in one place and be done with it. I’m not super familiar with ExpressVPN, but I think you’ll need to add the static route to plex.tv in every VPN server’s config file.

I thought I’d give IPVanish a try, and I really like the service (plus it may save me a few bucks each month), however, when I try to edit the config file I get access denied. I’m an administrator on this computer. All efforts to change permissions have failed – any ideas?