You are not logged in.

#1 2015-09-28 11:31:08

arch_fan1
Member
Registered: 2015-07-26
Posts: 6

Policy based routing with uid

Desktop with 1 physical NIC wlp0s29u1u5 connecting to the Internet. There is then a Openvpn client run on it as tun0.

How can I make it that user (uid 1000) traffic only uses tun0?


I've tried many guides, without sucess so far. Here's the latest I've tried.


echo 201 TunRoutTable >> /etc/iproute2/rt_tables
ip rule add fwmark 2 table TunRoutTable
ip route add default via 10.172.1.5 dev tun0 table TunRoutTable
ip route flush cache
iptables -t mangle -A OUTPUT -m owner --uid-owner 1000 -j MARK --set-mark 2
route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.254   0.0.0.0         UG    303    0        0 wlp0s29u1u5
10.172.1.5      0.0.0.0         255.255.255.255 UH    0      0        0 tun0
192.168.1.0     0.0.0.0         255.255.255.0   U     303    0        0 wlp0s29u1u5
192.168.5.1     10.172.1.5      255.255.255.255 UGH   0      0        0 tun0

Offline

Board footer

Powered by FluxBB