Just sharing a script I made to add static routes based on DNS lookup of www.plex.tv
It seems to change too often for me to manually update a static route table. As always, don’t run this if you don’t understand what it does… especially don’t run it automatically until you verify it works for you.
ROUTES="$(/usr/bin/nslookup plex.tv | grep Address: | cut -c 10- | sed s/", "/\/g | sed '1d' | sed 's/^/route add -net /' | sed 's/$/ netmask 255.255.255.255 dev eth0; /')"
eval $ROUTES
My biggest recommendation would be to run Plex separately from any VPN. A good way to accomplish that is to run any downloader apps + VPN in a Docker, instead of directly on the Syno.
Setting up a different downloader and a VPN and also plex inside docker sounds like a huge amount of work but I might try it whenever I wind up upgrading my NAS.
Some of that article refers to white listing incoming connections by IP which is not an issue for me. I just need to ensure the plex.tv does not go out over a tunnel so the right ip gets advertised.
Here’s another solution I use for telly but should probably also work with plex using namespaces you can route on a per application basis.
ip netns add myNamespace
ip link set eth1 netns myNamespace
ip addr flush dev eth1
ip netns exec myNamespace ifconfig eth1 192.168.12.136/24 up
ip netns exec myNamespace ifconfig lo 127.0.0.1/8 up
ip netns exec myNamespace route add default gw 192.168.12.1
Force app to run non vpn:
sudo ip netns exec myNamespace ./telly