For output connection route metric and routing table are enough.
But, for input, can have a problem, connection from second interface return using same routing decision as output, on most case client reject the connection assuming that is a spoofed connection. Or redirection just not work.
To solve it is necessary to ensure that connection coming from a interface return from its self. Routing from source coming to rescue.
Assuming wlan0 as secondary connection. and 192.168.5.55 as wlan0 ip.
Code: Select all
Name a routing table
# echo "201 wlan" >>/etc/iproute2/rt_tables
copy relevant routing from main to new table
# ip route add 192.168.5.0/24 dev wlan0 proto kernel scope link src 192.168.5.55 table wlan
# ip route add default via 192.168.5.1 table wlan
Insert a source routing rule
# ip rule add from 192.168.5.55/24 lookup table wlan
A trick, use ip route show to list main routing table
You can copy a entire line to add command of ip route add
To list a routing tabel of wlan
# ip route show table wlan
To list routing rules
# ip rule list
Before change routing table, copy result of these tree commands.
traceroute -i eth0 184.108.40.206
traceroute -i wlan0 220.127.116.11
And repeat after changes.