I'm trying to get some traffic to go through a VPN and other traffic to not do so.
Packets with a given fwmark are supposed to go to my default interface (wlo1
), and all other traffic to a tunnel interface (tun0
, using OpenVPN) in the main table. I have added this rule in nftables:
table ip test {
chain test {
type route hook output priority mangle; policy accept;
meta cgroup 1234 meta mark set 1
}
}
In the main routing table I have these entries:
default via 10.11.0.1 dev tun0
10.11.0.0/16 dev tun0 proto kernel scope link src 10.11.0.20
[WANIP.0]/24 dev wlo1 proto kernel scope link src [WANIP]
128.0.0.0/1 via 10.11.0.1 dev tun0
[VPNIP] via [WANGATEWAY] dev wlo1
Packets with fwmark 1
is instead led to their own routing table: ip rule add from all fwmark 1 lookup test
. In the test
table I have added the following route:
default via [WANGATEWAY] dev wlo1
When I run ping 8.8.8.8
from this cgroup, it's stuck. It seems able to send but not receive any packets.
VPN traffic works as expected.
What exactly is going on?