Zend certified PHP/Magento developer

Route wlan0 interface traffic through Wireguard wg0 interface

I built a Wireguard client in my Raspberry Pi based in this tutorial: https://blog.stigok.com/2019/03/26/raspberry-pi-wifi-ap-wireguard-port-53.html

My interfaces are:

eth0  (192.168.1.40/24) < -> router (192.168.1.1/24) < -> internet

wg0   (10.1.1.100/24)

wlan0 (192.168.254.1/24 dnsmasq + hostapd) < -> mobile clients connected (192.168.254.x/24)

They way I have it in /etc/wireguard/wg0.conf

using AllowedIPs = 0.0.0.0/0 makes all my traffic pass through Wireguard wg0 interface

using AllowedIPs = 192.168.254.0/24 I have to sudo ip addr flush dev wlan0 before brings wg0 up and I can’t access internet directly using eth0 interface.

How to fix my routes?