Our goal is to route a packet from a particular interface or source address range to the desired interface, even if that interface is not our default interface.
We have virtual machines bridged to the virbr1
interface and we want to route trafic of these VMs to a virtual network that is accessible via tun0
.
Assuming default NAT routing has been set up for the VM instances, we can route the traffic as follows:
ip rule add dev virbr1 table 100
ip route add default dev tun0 table 100