I would like for a program that binded to network interface that is not eth0 to use other default gateway when making connections.
ip rule add oif tun0 table 11
ip route add default via 10.3.33.20 table 11
ip route flush cache
ip rule list
0: from all lookup local
32764: from all iif tun0 lookup 11
32765: from all oif tun0 lookup 11
32766: from all lookup main
32767: from all lookup default
ip route list table all
default via 10.3.33.20 dev tun0 table 11
default via 172.104.159.1 dev eth0 proto static metric 100
10.3.0.0/16 dev tun0 proto kernel scope link src 10.3.33.21
172.104.159.0/24 dev eth0 proto kernel scope link src 172.104.159.249 metric 100
...
When I bind program to interface tun0 it does not transmit antything to gateway 10.3.33.20
works:
for some reason won't work: