Let's say eth0
has an ip 10.0.0.10
and its gateway is 10.0.0.1
. I want to add a route for 192.168.1.1
to use this interface.
What is the difference between these 3 commands?
route add -host 192.168.1.1 netmask 255.255.255.0 dev eth0
route add -host 192.168.1.1 netmask 255.255.255.0 gw 10.0.0.10
route add -host 192.168.1.1 netmask 255.255.255.0 gw 10.0.0.10 dev eth0
And which is preferred to use?