How to route IP LAN from Vyos1 to Nat to internet using Vyos2

Please help me on the requirement below.

The situation are :

  1. The connection between Router X to Vyos1(203.X.X.1) is using vpn ipsec site to site peer.
  2. Vyos 1 and Vyos2 have an Internet connection via eth0
  3. There is direct connection from Vyos1 to Vyos2 both using eth1

Some of the connection (besides using internet via Vyos1.
However, i would like to try if can using internet via Vyos2.
Please advise if this is possible.

Hi, zakwan
Maybe you met the same issue as me. Please follow my instruction to fixed this issue.

Hi echowings,

Its working. Thank you so much :+1:

Please say something to improve priority of the request feature.

Hi echowings,

I found a proper PBR using vyos commands instead of Linux.
Below is the Vyos commands i used to replace Linux commands :

  1. Need to set PBR on the policy commands
    VyosRouter1#sh policy route TO-Vyos2
    rule 1000 {
    set {
    table 100
    source {

  2. Set the static table 100 to Vyos2
    VyosRouter1# sh protocols static table 100
    route {
    next-hop 10.40.X.X {

  3. Set static route Vyos2 to Vyos1
    VyosRouter1# sh protocols static
    route {
    next-hop 10.40.X.X {

This is great. PBR is suitable for your case. But I need the Globle PBR function to let all network from vpn route to another gateway.