I have a Red Had Linux machine with two NICs:
- eth0 - 10.0.1.253 | 255.0.0.0
- eth1 - 10.0.1.1 | 255.255.255.0
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
10.0.1.0 * 255.255.255.0 U 0 0 0 eth1
link-local * 255.255.0.0 U 1002 0 0 eth0
10.0.0.0 * 255.0.0.0 U 0 0 0 eth0
default 10.0.0.1 0.0.0.0 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 10.0.1.3 | 255.0.0.0 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 10.0.1.3 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 10.0.1.3 out eth0. Any help would be great!!
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).If you were going to add a new default route for a new
10.0.2.0
network through theeth1
interface it might be something like this.Source: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Deployment_Guide/s1-networkscripts-static-routes.html
# route add -host 10.0.1.3 dev eth0