J
J
jzyken2017-10-20 02:44:17
linux
jzyken, 2017-10-20 02:44:17

Why does it substitute the wrong source ip when using policy-routing?

I'm trying to let the traffic of a specific user past the VPN in this way:

  1. I mark
    iptables -t mangle -A OUTPUT -m owner --uid-owner 1001 -j MARK --set-xmark 0xaaa

  2. I create a rule
    ip rule add fwmark 0xaaa table torrent
  3. Populate the routing table
    ip route add default via 192.168.0.1 dev enp2s0 src 192.168.0.125 table torrent
    ip route add 192.168.0.0/24 dev enp2s0 table torrent


And everything seems to work, the traffic does not go to tun0, but for some reason the packets go with src ip from the VPN.
Where did I make a mistake that I did not take into account, tell me, please?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question