If I have multiple network interfaces (here: 2) on a Linux machine (here: Debian Lenny). How do I see, over what network interface (NIC) a route to a specific destination host is going and what source IP address is used by default?

I have though of using

ping -I nic1 desthost.example.com
ping -I nic2 desthost.example.com

too see if both ways are possible. (Here: Both ways are possible)

I looked up the routing table

ip route show

But it's quite complex, so I thought, there must by a small simple tool, to just tell me:

"To destination host desthost.example.com it takes interface nicX and source IP address 10.0.0.1"

What is the simplest way of getting this information?

(And I'd rather not use tcpdump and set the interfaces in promiscous mode.)

Thanks.

link|improve this question
feedback

3 Answers

up vote 4 down vote accepted

Use ip route get <ip>.

link|improve this answer
Thanks. That is what I was looking for. – sandoz Oct 10 '10 at 16:51
feedback

what about route -C

link|improve this answer
feedback

i use netstat -Wcatnp

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.