I recently installed openvpn on my pi so that pihole and a few other processes can run behind a VPN. While it's worked great so far, it obviously broke remote access to my Plex server. So, after a bit of research, it seemed like creating a namespace for Plex was the way to go... but for the LIFE of me I can't get it working. I'm hoping there are some network-savy individuals that can help me out.
Here was my process for setting up the namespace with macvlan (my pi's local address is 192.168.1.15, and I'm setting the namespace up under 192.168.1.30). All of this used sudo since I'm logged in as pi:
ip netns add plexns
starting the loopback interface
ip netns exec plexns ip addr add 127.0.0.1/8 dev lo
ip netns exec plexns ip link set lo up
creating a macvlan interface
ip link add int0 link eth0 type macvlan mode bridge
ip link set int0 netns plexns
assigning an address
ip netns exec plexns ip addr add 192.168.1.30/24 dev int0
ip netns exec plexns ip link set int0 up
setting my gateway (router ip)
ip netns exec plexns ip route add default via 192.168.1.1
This seemed to work, because when I run
ip netns exec plexns curl icanhazip.com
it returns the external ip assigned by my ISP, not my VPN ip.
Next, i used
service plexmediaserver stop
to stop plex from running. And I edited /etc/init/plexmediaserver.conf so that that start-stop-daemon line read:
sudo ip netns exec plexns start-stop-daemon --start -c \
$PLEX_MEDIA_SERVER_USER --exec /usr/sbin/start_pms
Finally,
ip netns exec plexns service plexmediaserver start
Of course, it didn't work. When I log into the server on my computer, it's visible locally, but not remotely. It's still working under local IP 192.168.1.15, with external IP address of my VPN.
Sorry for the novel, but I'm a complete networking novice, and not really a programmer in general, so any help would be very much appreciated!
Raspberry Pi
? Maybe you ask better on our sister site Super User for general home networking?