Bypass Synology VPN with static route script

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

Is this so that you can run VPN + downloaders + Plex all on the same device?

Do you find that this bypass method works? I wouldn’t expect it to be sufficient. Plex uses a handful of hostnames for cloud services.

There’s a discussion of some of them here, including a way to look up the PubSub servers and a list of the inbound connectivity tester addresses.

Full list of IPs / hostnames Plex uses for remote access?

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.

It works fine for me, YMMV.

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

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.