Hey, mates. Need some help with nftables and WireGuard gateway config. Trying to route some IPs from fw777 nftable to my WireGuard gateway. Googled for days , hit a dead end. Even threw it at ChatGPT, and this is what it spat out:
#!/usr/sbin/nft -f
table inet fw777 {
set 777 {
type ipv4_addr
elements = { 1.1.1.1, 8.8.8.8 }
}
chain prerouting {
type filter hook prerouting priority mangle; policy accept;
ip saddr @777 meta mark set 17
}
chain output {
type filter hook output priority filter; policy accept;
ip daddr @777 meta mark set 17 counter accept
}
chain postrouting {
type filter hook postrouting priority srcnat; policy accept;
ip daddr @777 meta mark set 17 oifname "wg0" counter accept
}
}
ip rule add fwmark 17 table 17
ip route add default via <WireGuard IP> dev wg0 table 17
Tried it, but it didn't work. Any guidance from the pros would be super helpful, thank you.
I'm running OpenWrt 23.05.6 on an AC2100, with dnsmasq-full installed.