Host traffic over wireguard

Hello guys. I have a problem with routing all host traffic over wireguard interface.
My host is not a router, its just a small pc with vyos on a board.

My interfaces:

interfaces {
    bonding bond0 {
        address 192.168.0.4/24
        member {
            interface eth0
            interface eth1
        }
        mode 802.3ad
    }
    ethernet eth0 {
    }
    ethernet eth1 {
    }
    loopback lo {
    }
    wireguard wg01 {
        address 10.13.13.10/24
        description VPN
        peer firstPeer {
            address 1.2.3.4
            allowed-ips 0.0.0.0/0
            allowed-ips ::0/0
            port 51820
            pubkey ****************
        }
        private-key ****************
    }
}

vyos have a default gateway

protocols {
    static {
        route 0.0.0.0/0 {
            next-hop 192.168.0.3 {
            }
        }
    }
}

and my question: How to route all local traffic over wireguard tunnel?
thanks a lot.

Add route to wg peer via 192.168.0.3, and other traffic via wg interface.

set protocols static route 1.2.3.4/32 next-hop 192.168.0.3
set protocols static route 0.0.0.0/0 next-hop 10.13.13.1
1 Like