I own a dedicated server with some kvm vps running for my clients.
My main network is 192.168.1.0/24.
The vps have a dedicated network 192.168.2.0/24 on a bridge interface brv6.
The ipv6 traffic goes through my isp router as each vps have it's own ipv6 address.
But for my security, the ipv4 traffic is routed through a nordvpn wireguard vpn (10.5.0.1/24).
Here is the routing table for the vps:
default dev wg0 scope link
192.168.1.0/24 dev br0 scope link
Everything from brv6 use this routing table.
ip rule add iif brv6 table vps
Here is an illustration:
192.168.2.0/24 <==> 10.5.0.1/24 <==> Internet
VPS <==> NordVPN <==> Internet
As nordvpn servers don't know the network 192.168.2.0/24, i put a NAT between 192.168.2.0/24 and 10.5.0.1/24 so that every packet is NATed with my nordvpn client ip (10.5.0.2).
iptables -t nat -o wg0 -j MASQUERADE
But sometimes (randomly), some clients tell me they don't have ipv4 access.
After checking, i found some packets are not going through wireguard, but are in the physical interface (brv6 physical nic).
tcpdump -nni enp3s0f1 ip
Also, conntrack -L
shows connections with source address unNATed (in 192.168.2.0/24 instead of 10.5.0.2)
I really can't find a way to get this working.
Maybe you guys have an idea ?
The server is running debian 11 on Linux 5.10