Plex with Mullvad
How to get Plex working with Mullvad.
First add a Port to be forwarded to your Mullvad account
- 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.
- Reconnect to a VPN server.
- 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
- Open Plex
- Click on Settings
- Click on Remote access
- Enable remote acces
- Check the Manually specify public port checkbox and enter the port number you were previously assigned and click on APPLY
Add a firewall rule
- Click on the Windows key (Start)
- Type wf.msc and hit enter
- Click on Inbound Rules to select it
- Click on New Rule...
- Select Port and then Next
- Select TCP and Specific local ports and enter the port number you were assigned previously and then click Next
- Select Allow the connection and then Next
- Select both Private and public networks and click Next
- Enter a name, for instance "Plex port XXXXX" and then click on Finish
Add a forwarding rule
- Open a command prompt and run it as Administrator (Windows key type CMD and then click on "Run as Administrator")
- 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
- Open notepad and paste the netsh command into it.
- Save the file as plex.bat
- Click on the Windows key and type taskschd.msc and then hit enter
- Click on Create basic task,
- Name it Plex and click on Next
- Select When I log on then Next.
- Select Start a program and click on Next.
- In the Program/script field click on browse and add the plex.bat that you previous created and click on Next
- Click on Finish
- Click on Task Scheduler library
- Double click on Plex
- Select Run with highest privileges found under General
- Save the changes by clicking on OK
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)
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">
Then press ctrl + x and then Y to save.
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.