https://github.com/hsand/pia-wg
I took that and added some features to it a while ago, along with a new script to send a Wireguard config to RouterOS:
https://github.com/kchiem/pia-wg
NOTE: The Wireguard config to RouterOS script can be used for any vpn, not just PIA.
Usage is documented at the url above, and as mentioned, it's up to you from there on to decide what traffic you want to route through the new interface. Here's an example on how to do split tunneling and only route certain destinations through the vpn:
1. Create an address list for the sites you want to route through the vpn:
Code: Select all
/ip/firewall/address-list/add list=vpn-list address=wtfismyip.com
2. Mark your connections and packets:
a. mark the connections to the address list above with the connection mark "vpn-connections"
Code: Select all
/ip/firewall/mangle/add action=mark-connection chain=prerouting connection-mark=no-mark dst-address-list=vpn-list new-connection-mark=vpn-connections
Code: Select all
/ip/firewall/mangle/add action=mark-routing chain=prerouting connection-mark=vpn-connections in-interface-list=bridge-local new-routing-mark=vpn-routing
a. create a new routing table to use
Code: Select all
/routing/table/add fib name=vpn-table
Code: Select all
/ip/route/add check-gateway=none distance=1 dst-address=0.0.0.0/0 gateway=wg-pia-il routing-table=vpn-table
Code: Select all
/routing/rule/add action=lookup routing-mark=vpn-routing table=vpn-table
Code: Select all
/interface/list/add name=WAN
/interface/list/member/add interface=wg-pia-il list=WAN
/ip/firewall/nat/add action=masquerade chain=srcnat out-interface-list=WAN
Code: Select all
/ip/firewall/nat/add action=masquerade chain=srcnat out-interface=wg-pia-il
Code: Select all
curl http://wtfismyip.com/text