Ubuntu, specify interface for a single destination ip
Solution 1:
This is a simple scenario. You need to have two things:
- Default gateway via
eth0
. Next hop will be192.168.0.Y
. - Static route for single host
8.8.8.8
viawlan0
. Next hop will be192.168.1.Y
.
No need to add any rule using iptables.
You can add the default route and static route using these two commands respectively:
ip route add default via 192.168.0.Y
ip route add 8.8.8.8/32 via 192.168.1.Y