First of all bond
has nothing to do with that, and basically, the drill is to make use of an ip rule, which looks up another route table (that consists of a default route with dev wg0
) for all the traffics from eth1
.
ip route add default dev wg0 table 123
ip rule add iif eth1 lookup 123
(The number 123
is arbitrary. You'll need to refine them if you e.g. want the eth1
hosts to be able to reach the eth0
hosts.)
Certainly IP forwarding needs to be enabled (sysctl) and allowed (firewall, if any) as well.
Then you decide whether you want to masquerade/NAT for the eth1
IP subnet, or add a return route for it on the wireguard server. The latter is recommended when possible, and one of the reasons is that you'll need to masquerade/NAT on wireguard server anyway (for either 10.1.1.2
or the eth1
IP subnet), assuming you want to use one of its interface for Internet connection. (The number of layers of NAT should be kept to the minimal.)
(I'm assuming 10.1.1.2
is the WG IP on the Pi. It's unclear which conf you have shown.)
Make sure the eth1
IP subnet does not conflict with any that is used on the wireguard server, if you choose not to NAT for it on the Pi. Also the subnet needs to be added to AllowIPs=
on the wireguard server in that case.
Most likely you should use the PostUp=
for the aforementioned setup, as I'm not sure if netplan has a way for you to specifiy it. (The added route should be gone when wg0
is gone, so you only need to delete the ip rule with Pre
/PostDown=
.)
EDIT: You should probably use Table=off
on the client conf, unless you want the Pi's own traffics to go into the tunnel as well.