You have rules in place to actually mark the traffic?
It can help if we can see your configs, please connect to your OpenWRT device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button
Remember to redact keys, passwords, MAC addresses and any public IP addresses you may have:
ubus call system board
cat /etc/config/network
cat /etc/config/firewall
ip route show
ip route show table all
ip rule show
wg show
Note instead of making a table with default route:
You can also use Option4table and Option6Table (on the Interface Advanced tab: Override IPv4/6 routing table ) which will create a vpn table with default route.
In that case make sure you enable the default route via the vpn with Allowed IPs: 0.0.0.0/0, ::/0 and Enabling Route Allowed IPs
root@OpenWrt:~# cat /etc/config/firewall
config defaults
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option synflood_protect '1'
config zone
option name 'lan'
option input 'ACCEPT'
option output 'ACCEPT'
option forward 'ACCEPT'
list network 'lan'
config zone
option name 'wan'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
option mtu_fix '1'
list network 'wan'
config forwarding
option src 'lan'
option dest 'wan'
config rule
option name 'Allow-DHCP-Renew'
option src 'wan'
option proto 'udp'
option dest_port '68'
option target 'ACCEPT'
option family 'ipv4'
config rule
option name 'Allow-Ping'
option src 'wan'
option proto 'icmp'
option icmp_type 'echo-request'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-IGMP'
option src 'wan'
option proto 'igmp'
option family 'ipv4'
option target 'ACCEPT'
config rule
option name 'Allow-DHCPv6'
option src 'wan'
option proto 'udp'
option dest_port '546'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-MLD'
option src 'wan'
option proto 'icmp'
option src_ip 'fe80::/10'
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Input'
option src 'wan'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
list icmp_type 'router-solicitation'
list icmp_type 'neighbour-solicitation'
list icmp_type 'router-advertisement'
list icmp_type 'neighbour-advertisement'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-ICMPv6-Forward'
option src 'wan'
option dest '*'
option proto 'icmp'
list icmp_type 'echo-request'
list icmp_type 'echo-reply'
list icmp_type 'destination-unreachable'
list icmp_type 'packet-too-big'
list icmp_type 'time-exceeded'
list icmp_type 'bad-header'
list icmp_type 'unknown-header-type'
option limit '1000/sec'
option family 'ipv6'
option target 'ACCEPT'
config rule
option name 'Allow-IPSec-ESP'
option src 'wan'
option dest 'lan'
option proto 'esp'
option target 'ACCEPT'
config rule
option name 'Allow-ISAKMP'
option src 'wan'
option dest 'lan'
option dest_port '500'
option proto 'udp'
option target 'ACCEPT'
config zone
option name 'vpn_client'
option input 'REJECT'
option output 'ACCEPT'
option forward 'REJECT'
option masq '1'
list network 'wg_vps'
config forwarding
option src 'lan'
option dest 'vpn_client'
config ipset
option name 'vpn'
option family 'ipv4'
list match 'dest_net'
config rule
option name 'mark_vpn'
option family 'ipv4'
list proto 'all'
option src 'lan'
option ipset 'vpn'
option dest '*'
option target 'MARK'
option set_mark '0x1'
root@OpenWrt:~# ip route show
default via *.*.*.* dev lan0 proto static src *.*.*.*
*.*.*.*/22 dev lan0 proto kernel scope link src *.*.*.*
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1
root@OpenWrt:~# ip route show
default via *.*.*.* dev lan0 proto static src *.*.*.*
*.*.*.*/22 dev lan0 proto kernel scope link src *.*.*.*
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1
root@OpenWrt:~# ip route show table all
default dev wg_vps table vpn proto static scope link
default via *.*.*.* dev lan0 proto static src *.*.*.*
*.*.*.*/22 dev lan0 proto kernel scope link src *.*.*.*
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.1
local *.*.*.* dev lan0 table local proto kernel scope host src *.*.*.*
broadcast *.*.*.* dev lan0 table local proto kernel scope link src *.*.*.*
local 10.8.1.2 dev wg_vps table local proto kernel scope host src 10.8.1.2
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1
local 192.168.1.1 dev br-lan table local proto kernel scope host src 192.168.1.1
broadcast 192.168.1.255 dev br-lan table local proto kernel scope link src 192.168.1.1
fd57:d4b:590d::/64 dev br-lan proto static metric 1024 pref medium
unreachable fd57:d4b:590d::/48 dev lo proto static metric 2147483647 pref medium
fe80::/64 dev br-lan proto kernel metric 256 pref medium
fe80::/64 dev lan0 proto kernel metric 256 pref medium
local ::1 dev lo table local proto kernel metric 0 pref medium
anycast fd57:d4b:590d:: dev br-lan table local proto kernel metric 0 pref medium
local fd57:d4b:590d::1 dev br-lan table local proto kernel metric 0 pref medium
anycast fe80:: dev br-lan table local proto kernel metric 0 pref medium
anycast fe80:: dev lan0 table local proto kernel metric 0 pref medium
local fe80::1ae8:29ff:febc:33e6 dev lan0 table local proto kernel metric 0 pref medium
local fe80::1ae8:29ff:febc:33e7 dev br-lan table local proto kernel metric 0 pref medium
multicast ff00::/8 dev br-lan table local proto kernel metric 256 pref medium
multicast ff00::/8 dev lan0 table local proto kernel metric 256 pref medium
multicast ff00::/8 dev wg_vps table local proto kernel metric 256 pref medium
root@OpenWrt:~# ip rule show
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
root@OpenWrt:~# wg show
interface: wg_vps
public key: ****
private key: (hidden)
listening port: 47841
peer: ****
endpoint: ****
latest handshake: 5 seconds ago
transfer: 11.82 KiB received, 33.13 KiB sent
persistent keepalive: every 20 seconds
I want to route only traffic to the hosts from the list.
Thanks, with this option, everything works as I planned. But I'd rather not rely on routing by wg rules as I want to move away from wg in the future. Everything has been working for me for the last few years without this option. May be I need to add some route?
With a /24 there automatically will be a local route made (10.8.1.0/24) very useful if you e.g. have a DNS server in that subnet or for debugging or if you want to connect to other peers etc. and it does not hurt so I would always do this (using a /24 address) (but that is just me )
Enabling this will stop making a route to the WG endpoint via the wan, which is necessary if you have a default route via the WG tunnel.
In your case, where you do not have a default route via the tunnel, you actually do not need a host route but for me it is good practice to have it anyway (but that is just me)