I’ve been manipulating the Linux routing table by “route add” and “route del”. Now given an IP, how can I know (by typing some command) which gateway/device will it go through?
For example, if I have run:
route add -net 192.57.66.0 netmask 255.255.255.0 dev eth0
Is there a command that can tell me if I visit 192.57.66.42, it will go through eth0?
You should stop using net-tools, because you won’t find the answer there. But for iproute: