Page 1 of 1

Redirecting only serviio traffic via tunnel on Linux

PostPosted: Mon Oct 07, 2013 10:25 am
by wae3iejohhohZae5
Let
  • serviio be the username running the Serviio process
  • eth0 be the primary interface where default traffic is sent out on
  • tun0 be the interface of the tunnel
  • 192.168.0.0/24 be the local area network ip subnet on eth0
  • 192.168.0.1 be the default gateway on the local area network eth0
  • 172.20.0.1 be the gateway on tun0
Then the following sends all Serviio traffic along tun0.
  Code:
echo 2 > /proc/sys/net/ipv4/conf/tun0/rp_filter
iptables -t mangle -A OUTPUT -o eth0 -m owner --uid-owner serviio -j MARK --set-mark 11
iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
ip rule add fwmark 11 table 11
ip route add 192.168.0.0/24 dev eth0 table 11 # no VPN for LAN
#ip route add 1.2.3.4 via 192.168.0.1 dev eth0 table 11 # no VPN for 1.2.3.4
ip route add default via 172.20.0.1 dev tun0 table 11

Re: Redirecting only serviio traffic via tunnel on Linux

PostPosted: Mon Oct 07, 2013 11:43 am
by zip
is this an actual guide? Maybe it should go to the wiki.

Re: Redirecting only serviio traffic via tunnel on Linux

PostPosted: Mon Oct 07, 2013 12:15 pm
by Iveky
but with little better explanation

Re: Redirecting only serviio traffic via tunnel on Linux

PostPosted: Mon Oct 07, 2013 8:16 pm
by wae3iejohhohZae5
I am just sharing this with you because it took me too many hours to figure it out. Feel free to improve it or put it on the wiki.

Re: Redirecting only serviio traffic via tunnel on Linux

PostPosted: Thu Oct 10, 2013 6:27 am
by paniko
wae3iejohhohZae5 wrote:I am just sharing this with you because it took me too many hours to figure it out. Feel free to improve it or put it on the wiki.



with this configuration you are able to route the uPnP traffic too?

Re: Redirecting only serviio traffic via tunnel on Linux

PostPosted: Thu Oct 10, 2013 1:20 pm
by wae3iejohhohZae5
paniko wrote:
wae3iejohhohZae5 wrote:I am just sharing this with you because it took me too many hours to figure it out. Feel free to improve it or put it on the wiki.



with this configuration you are able to route the uPnP traffic too?

I don't think so.