I have a Red Had Linux machine with two NICs:

  • eth0 - |
  • eth1 - |

So the first one is on a class A subnet, the second is on a class C subnet.

This is what my routing table looks like:

Destination  Gateway   Genmask        Flags Metric Ref Use Iface     *  U     0      0     0 eth1
link-local   *    U     1002   0     0 eth0     *      U     0      0     0 eth0
default        UG    0      0     0 eth0

The two NICs are connected to separate physical (actually virtual) LAN segments and I have a host connected to the same LAN segment eth0 is with IP | but I can't ping it from this machine because it appears its getting confused and sending out eth1. When I disable eth1 to force the packet to go out eth0 it connects but I need both enabled.

I'm thinking the solution is to add a manual route to my host to force it to go through eth0. I'm not sure given the information above what the command would be to manually the route. Basically I need to send any traffic to out eth0. Any help would be great!!

2 Answers 2


# route add -host dev eth0


On a newer machine using the ip binary the syntax to add a route is slightly different (but thankfully really consistent for hosts/networks/etc).

ip route add via dev eth0

If you were going to add a new default route for a new network through the eth1 interface it might be something like this.

ip route add via dev eth1

Source: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/s1-networkscripts-static-routes.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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