I’ve set up two routers R1 and R2 (ROS 7.1.1) and connected them with wireguard. Tunnel works fine, I can ping both endpoints.
I’m trying to use it as a kind of VPN, forwarding part of the traffic from R1 via R2 to the internet.
So - I’ve set up routes, firewall rules. Firewall counters on R2 shows that packets from R1 are arriving.
If I open packet sniffer on R2 I can see packets from R1 on both wireguard link and internet link with original IP address of R1.
Now I have to NAT the traffic - so I went to NAT chain and add MASQ rule. Tried following filters:
rule based on source IP of R1 - Does not work, NAT counters stays at 0.
rule based on connection mark with mangle marking packets (mangle counters shows that there is traffic) - Does not work, NAT counters stays at 0.
catch-all rule for all traffic going out on R2 - Does not work
So - it looks like NAT chain does not catch wireguard-originated traffic.
Such instances are rare and not the norm and usually fall into the category if you have an ISP router before your MT router and are trying to do something extra…
Without seeing the configs on both ends, assistance will be futile…
btw: it works and is not using masq/snat rules. I can disable them. It is strange, I don’t understand what is changing source address.
Does wireguard have it’s own MASQ?
One explanation would be that you started ping before you had srcnat rule, conntrack made a virtual connection for it without srcnat, and when you added srcnat rule later, it still used what it had from before. That’s because srcnat works only for new connections (from the first packet). Same happens when you first have srcnat, then disable it, but ping still works and is natted. But if you’d stop it, let the “connection” time out, then next ping would be seen as new connection.