By default you have one routing table which you can see by running the command
Now because you want to do policy based routing you need a second table which i have named table 4 it can be any other number or you can make it a label by adding the mapping to /etc/iproute2/rt_tables.
We have the relevant routes to handle the traffic in this second table.
Then to force the traffic to use the table we use the fwmark rule with works hand in hand with iptables marking in the mangle table. There other ways to specify rules.
To get all the details on how advanced routing on linux works look at
And read these sites.