Sometimes when you have a subnet accessible from an interface that is not along the default gateway (such as a group of private routed subnets in 10.x.y.z), you need to add a manual route.

Say for example vlan 2 is on 10.1.0.0/16 and has a router on 10.1.1.1 that also serves 10.2.0.0/16.  You cant put a GATEWAY=10.1.1.1 in the ifcfg-eth0.2 file, since that will (potentially) override the GATEWAY setting in ifcfg-eth0 that reaches the Internet (i.e. you’d be able to reach 10.2.x.x but not google.com).  The solution is to specify manually a route that directs only the 10.2.0.0/16 subnet to the gateway 10.1.1.1 like this:

 

route-eth0.2

10.2.0.0/16 via 10.1.1.1


It couldn’t be easier than that.  Do a service network restart to reload the new route specified in the file.