Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
ping -I nic2

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 it takes interface nicX and source IP address"

What is the simplest way of getting this information?

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


share|improve this question
up vote 15 down vote accepted

Use ip route get <ip>.

share|improve this answer
Thanks. That is what I was looking for. – sandoz Oct 10 '10 at 16:51
And to get only the interface: ip -o route get $ipaddress | perl -nle 'if(/dev\s+(\S+)/) {print $1}' – mivk Jul 6 '14 at 13:32
or ip -o route get $ipaddress | awk '{ print $5 }' – ShadowFlame Mar 23 '15 at 10:53

what about route -C

share|improve this answer
route is deprecated. use iproute2. – madCode Mar 8 at 3:42

I use netstat -Wcatnp . You should try this command.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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