I see different subnets and I think what you are trying to do is to communicate different subnets, am I right? What do you mean by PBR in the same subnet? By definition PBR is about routing, which means communicating different subnets.
In order to help you, could you clarify what you want to achieve (maybe you can provide a diagram)?
Lan1 and lan2 routers are CPE managed by respective ISPs
I want all host in switch 1 to be part of LAN1 and Switch 2 to be part of Lan2.
All hosts in switch 1 access the internet from Lan1 and all hosts from switch 2 access the internet from Lan2 and all hosts in Lan1 and Lan2 connect with each other (that’s why pbr)
@sd0 you have mistakes with configuration
You use eth1 and eth2 without vlans, but you set policy routes with vlan10 and vlan11.
set interfaces ethernet eth1 vif 10 policy route ‘PBR’
set interfaces ethernet eth2 vif 11 policy route ‘PBR’
Example in docs was with one ethernet interface and 2 subinterfaces (vlans).
set interfaces dummy dum0 address '10.10.10.255/32'
set interfaces ethernet eth1 address '192.168.1.1/24'
set interfaces ethernet eth1 description 'LAN1'
set interfaces ethernet eth1 policy route 'PBR01'
set interfaces ethernet eth2 address '192.168.2.1/24'
set interfaces ethernet eth2 description 'LAN2'
set interfaces ethernet eth2 policy route 'PBR02'
set interfaces loopback lo
set policy route PBR01 rule 10 destination address '192.168.2.0/24'
set policy route PBR01 rule 10 set table 'main'
set policy route PBR01 rule 20 set table '10'
set policy route PBR01 rule 20 source address '192.168.1.0/24'
set policy route PBR02 rule 10 destination address '192.168.1.0/24'
set policy route PBR02 rule 10 set table 'main'
set policy route PBR02 rule 20 set table '11'
set policy route PBR02 rule 20 source address '192.168.2.0/24'
set protocols static table 10 route 0.0.0.0/0 next-hop 192.168.1.10
set protocols static table 11 route 0.0.0.0/0 next-hop 192.168.2.10
set service dhcp-server shared-network-name LAN1 subnet 192.168.1.0/24 default-router '192.168.1.1'
set service dhcp-server shared-network-name LAN1 subnet 192.168.1.0/24 dns-server '1.1.1.1'
set service dhcp-server shared-network-name LAN1 subnet 192.168.1.0/24 lease '86400'
set service dhcp-server shared-network-name LAN1 subnet 192.168.1.0/24 range rang01 start '192.168.1.100'
set service dhcp-server shared-network-name LAN1 subnet 192.168.1.0/24 range rang01 stop '192.168.1.254'
set service dhcp-server shared-network-name LAN2 subnet 192.168.2.0/24 default-router '192.168.2.1'
set service dhcp-server shared-network-name LAN2 subnet 192.168.2.0/24 dns-server '1.1.1.1'
set service dhcp-server shared-network-name LAN2 subnet 192.168.2.0/24 lease '86400'
set service dhcp-server shared-network-name LAN2 subnet 192.168.2.0/24 range rang01 start '192.168.2.100'
set service dhcp-server shared-network-name LAN2 subnet 192.168.2.0/24 range rang01 stop '192.168.2.254'
So PC01 can ping 10.10.1.100
vpc01> ping 10.10.1.100
84 bytes from 10.10.1.100 icmp_seq=1 ttl=64 time=1.294 ms
84 bytes from 10.10.1.100 icmp_seq=2 ttl=64 time=1.127 ms
84 bytes from 10.10.1.100 icmp_seq=3 ttl=64 time=1.331 ms
84 bytes from 10.10.1.100 icmp_seq=4 ttl=64 time=1.143 ms
84 bytes from 10.10.1.100 icmp_seq=5 ttl=64 time=1.366 ms
vpc01>
PC02 can ping 10.10.2.100
vpc02> ping 10.10.2.100
84 bytes from 10.10.2.100 icmp_seq=1 ttl=64 time=1.000 ms
84 bytes from 10.10.2.100 icmp_seq=2 ttl=64 time=1.093 ms
84 bytes from 10.10.2.100 icmp_seq=3 ttl=64 time=1.386 ms
84 bytes from 10.10.2.100 icmp_seq=4 ttl=64 time=1.558 ms
84 bytes from 10.10.2.100 icmp_seq=5 ttl=64 time=1.228 ms
vpc02>