this was found here --> https://www.niftiestsoftware.com/2011/08/28/making-all-network-traffic-for-a-linux-user-use-a-specific-network-interface <-- by accedent and worked very nicely for me so I saved it here to find easier next time.
I’ve recently been testing out a VPN service, and normally while running the VPN, all internet traffic goes over the VPN interface. This isn’t really ideal, as I only want traffic from a specific application (qBittorrent) to use the VPN. IPTables doesn’t seem to have the option to filter specific processes, but it can filter based on a specific user account.
IPTables itself doesn’t really deal with routing packets to interfaces, so we can’t use it to directly route packets. We can however mark packets from the user so they can be routed by the ip routing table. I’ve created a script to flush and apply firewall rules, which does what we need ( obviously set the variables at the beginning of the script to match your details ):
#! /bin/bash