You need to have a policy rule for that subnet and set it to use the main table instead of the wg one. So make another rule (let’s say 5) in your PBR policy, with a destination 192.168.1.0/24 and set table main.
thank you for your answer but it doesn’t work, I added this :
set policy route PBR rule 5 destination address '192.168.3.0/24'
set policy route PBR rule 5 destination address '192.168.1.0/24'
set policy route PBR rule 5 set table 'main'
I can ping 192.168.1.254 from my client (its working with or without the rule “table main” ), but for example I can’t go out of the 192.168.1.254 to the 192.168.1.1
Example : if from my client i ping the 192.168.1.40 as you can see the packet don’t follow the main rule, he use wg0 instead eth1 to use eth0:
tcpdump -nvv host 192.168.1.40 -i wg0
15:56:13.945634 IP (tos 0x0, ttl 63, id 9747, offset 0, flags [DF], proto ICMP (1), length 84)
10.205.212.10 > 192.168.1.40: ICMP echo request, id 21181, seq 1, length 64
15:56:14.953498 IP (tos 0x0, ttl 63, id 9762, offset 0, flags [DF], proto ICMP (1), length 84)
10.205.212.10 > 192.168.1.40: ICMP echo request, id 21181, seq 2, length 64
(sorry i my english was not perfect, thanks from France)
Hello @Viacheslav thanks for you help, yes I want exclude 192.168.1.0 to go in the wg0 trough the PBR, I have try your command, but still don’t work, i continue to see the packets to go out by wg0, the good interface was eth0.
Results with your command, (tcpdump from VyOS with a ping from my client R1 on diagram)
vyos@vyos# tcpdump -nvv -i wg0
tcpdump: listening on wg0, link-type RAW (Raw IP), capture size 262144 bytes
07:57:50.054782 IP (tos 0x0, ttl 63, id 65091, offset 0, flags [DF], proto ICMP (1), length 84)
10.205.212.10 > 192.168.1.1: ICMP echo request, id 12506, seq 36980, length 64
07:57:50.630832 IP (tos 0x0, ttl 63, id 65211, offset 0, flags [DF], proto ICMP (1), length 84)
10.205.212.10 > 192.168.1.1: ICMP echo request, id 13459, seq 77, length 64
I have try some modification like this:
conf
set nat source rule 850 outbound-interface 'wg0'
set nat source rule 850 protocol icmp
set nat source rule 850 exclude
commit