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