Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I have two systems and each have a NIC with two ethernet ports. One system has a verified NIC card, but the other has a NIC which has to be verified.

I use ping to verify whether the interfaces on the NIC card is functioning correctly.

Why does each interface have to be on a different subnet for ping to work?

For example:

System 1:  eth0 (, eth1 ( -->This NIC is tested good
                  ^                ^
                  |                |
                  V                V
System 2:  eth0 (, eth1 ( -->This NIC is being tested

In this setup, eth0 on System 1 is connected to eth0 on System 2. And eth1 on System 1 is connected to eth1 on System 2. I am using submet mask of

So on System 2, I would do the following:

$ ping -I eth0 -c 100 -qA
$ ping -I eth1 -c 100 -qA

Why couldn't I have this setup though?

System 1:  eth0 (, eth1 ( -->This NIC is tested good
                  ^                ^
                  |                |
                  V                V
System 2:  eth0 (, eth1 ( -->This NIC is being tested

And then do:

$ ping -I eth0 -c 100 -qA
$ ping -I eth1 -c 100 -qA

What is it about having a host with multiple interfaces?

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface         UG        0 0          0 eth0   U         0 0          0 eth1   U         0 0          0 eth2     U         0 0          0 eth0   U         0 0          0 eth0
share|improve this question
what do you want to ask? ping still works even if your interfaces in the same subnet. – cuonglm Jul 3 '14 at 7:07
netstat -rn | grep default – Warwick Jul 3 '14 at 7:08
@Gnouc : You will not be able to ping in the second setup of using ip address ( ping will only work in the first case. – user1527227 Jul 3 '14 at 7:12
@Warwick what is that supposed to do? – user1527227 Jul 3 '14 at 7:12
@user1527227: Is your two host in the same network or not? – cuonglm Jul 3 '14 at 7:15

If you have a different network configured for eth1 on systems 1 and 2, then by default, any packets for that network will use those interfaces, rather than eth0. When they are all on the same network though, they will get sent via the default route unless there is a specific route specified on system 2 that says send packets to via

To view the routing table on system 2, run

netstat -rn

If no specific route is set up for this network, then the default route will be used.

To change that behaviour, you would run on system 2 a command similar to:

route add -host

(Sorry, I don't use Ubuntu so the syntax may be different. Perhaps someone can verify and edit this answer if required.)

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.