Source IP selection or multi-home or multi-interface issue - solved with source-based route - was: Re: Wireguard source ip selection issue with multi interfaces

曹煜 cao88yu at
Fri Oct 21 14:12:58 UTC 2022

Actually, I've hacked the wireguard source code by myself months ago,
and it's working as expected on openwrt with mwan3.
See details and the last hack patch on my github issue:
As I said on the issue, the problem is wireguard always reset the
incoming ip and ipmark, and then select the source ip from main
routing table.

Janne Johansson < at> 于2022年10月21日周五 21:27写道:
> > "How should wireguard know which IP is the correct source IP address?"
> >
> > I digged into the source code but couldn't find the part where the source-IP is selected for outgoing connections (like a simple ping).
> > I am not a developer but would like to try to understand it. Could someone give me a pointer?
> I think it is left to the OS and it's tcp stack to pick the ip (and
> interface) based on the UDP destination ip and the current routing
> table when sending udp packets.
> --
> May the most significant bit of your life be positive.

More information about the WireGuard mailing list