Network Issues Configuring two interfaces

Having issues when I configure a second interface in a different subnet. When I setup eth1 with an IP in a different subnet than eth0 and it is enabled and up, I can ping the IP of eth0 if I am in the same subnet but not able to if I am in a different subnet. If i disable eth1, I am able to ping eth0 while on the same subnet and also in a different subnet. I have made sure the gateway is setup for eth0. Any ideas what may be wrong?

Thanks Skyking, That does make sense and when I added the route for the particular vlan it is working now.

It’s called routing, you will need to get your head around how it works and how you arrange for hosts on one physical (or virtual) network to see and forward to those on another physical (or vitual) network (and vice versa) in your “routing table”. There are dozens of tutorials out there. Be careful that your networks are routeable and that they do not overlap.

Shouldn’t the routing be done by the core switch or am I going to have to add a route table to linux box?

Switches don’t route, routers do, you need to add routes to your box if you want routing.

Well most core switches are Layer 3 so indeed VLAN routing could be happening in a core switch.

You seem to not understand the difference between a default route and a gateway, in a 1 interface system they are almost always the same, however with two interfaces (connected networks) you need to define what networks are reachable from what gateways:

IE: NIC 1 IP 10.1.1.69 - Gateway on that network is 10.1.1.254
IE NIC 2 IP 182.168.20.69 - Gateway on that network is 192.168.20.254

So, remembering that gateways must be in the same LAN segment as the connected interface(and assuming the networks are /24) the routing table would look like this. Also routing tables always parse from most specific to least specific

route add -net 192.168.0.0 netmask 255.255.255.0.0 gw 192.168.20.254
route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.1.1.254

This would route all traffic on 192.168.x.x (a fictitious corporate WAN) out NIC2 and NIC1 would be the default gateway for all other traffic. You can get much more granular than my example.

None of this is specific to Linux it’s just IP 101.

Also note that the route command is one way to accomplish and is not stateful across reboots. You can config default gateways is the /etc/sysconfig/network-scripts/ethxx files and routes in the /etc/sysconfig/network-scripts/route-ethxx

I hope this makes some degree of sense to you.