Plex with Mullvad

How to get Plex working with Mullvad.

 

First add a Port to be forwarded to your Mullvad account

  1. Log in to your Mullvad account on our website and then click on ADD PORT  to add a port that you can use for Plex.
  2. Reconnect to a VPN server.
  3. In the Mullvad VPN app click on the Settings icon,  preferences and then enable Local network sharing

 

Change Plex to listen on the added port

  1. Open Plex
  2. Click on Settings
  3. Click on Remote access
  4. Enable remote acces
  5. Check the Manually specify public port checkbox and enter the port number you were previously assigned and click on APPLY

 

 

 

Windows

Add a firewall rule

  1. Click on the Windows key (Start)
  2. Type wf.msc and hit enter
  3. Click on Inbound Rules to select it
  4. Click on New Rule...
  5. Select Port and then Next
  6. Select TCP and  Specific local ports and enter the port number you were assigned previously and then click Next
  7. Select Allow the connection and then Next
  8. Select both Private and public networks and click Next
  9. Enter a name, for instance "Plex port XXXXX" and then click on Finish

 

Add a forwarding rule

  1. Open a command prompt and run it as Administrator (Windows key type CMD and then click on "Run as Administrator")
  2. Write the following (on a single line) and then press enter (replace xxxxx with the port you were assigned) :
    netsh interface portproxy add v4tov4 listenport=xxxxx listenaddress=0.0.0.0 connectport=32400 connectaddress=127.0.0.1

 

Making it start the forwarding rule when you log in to Windows

  1. Open notepad and paste the netsh command into it.
  2. Save the file as plex.bat
  3. Click on the Windows key and type taskschd.msc and then hit enter
  4. Click on Create basic task,
  5. Name it Plex and click on Next
  6. Select When I log on then Next.
  7. Select Start a program and click on Next.
  8. In the Program/script field click on browse and add the plex.bat that you previous created and click on Next
  9. Click on Finish
  10. Click on Task Scheduler library
  11. Double click on Plex
  12. Select Run with highest privileges found under General
  13. Save the changes by clicking on OK

 

macOS

Enable forwarding by opening a terminal and issuing sudo sysctl -w net.inet.ip.forwarding=1

 

Add a forwarding rule (replace xxxxx with the port you were assigned)
echo "rdr pass inet proto tcp from any to any port xxxxx -> 127.0.0.1 port 32400" | sudo pfctl -ef -

 

Adding a persistant redirect rule (replace xxxxx with the port you were assigned)

sudo su
echo "rdr pass inet proto tcp from any to any port xxxxx -> 127.0.0.1 port 32400" > /etc/pf.anchors/plex

 


Create com.plex.pfctl.plist file
sudo nano /Library/LaunchDaemons/com.plex.pfctl.plist

 

Paste the following into it
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple Computer/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.plex.pfctl.plist</string>
<key>Program</key>
<string>/sbin/pfctl</string>
<key>ProgramArguments</key>
<array>
<string>/sbin/pfctl</string>
<string>-e</string>
<string>-f</string>
<string>/etc/pf.anchors/plex</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>LaunchOnlyOnce</key>
<true/>
</dict>
</plist>

Then press ctrl + x and then Y to save.

 

Linux

Add redirect rule (replace xxxxx with the port you were assigned)
sudo iptables -t nat -I PREROUTING -p tcp --dport xxxxx -j REDIRECT --to 32400

 

Keep in mind that you can not connect to the SOCKS5 proxies exit IP, since SOCKS5 does not support port forwarding.