Centos multiple NICs routing issue
For any network device which is not my default gateway, I usually set the default route flag to no:
DEFROUTE="no"
This seems to work without any issues for my servers with multiple network interfaces. If you then restart your network service or interfaces, you should be able to check the routes to see that this is actually working:
/sbin/route -n
Hopefully this helps.
You can specify the default gateway in the file /etc/sysconfig/network like this on its own line: GATEWAY=192.168.0.1
If you need multiple gateways you can create a shell script like this:
#!/bin/sh
ip rule add from 172.21.107.112/28 pref 200 lookup 201
ip route add default via 172.21.107.113 dev eth1 table 201
ip rule add from 192.168.126.0/25 pref 200 lookup 202
ip route add default via 192.168.126.126 dev eth0 table 202
ip route add default nexthop via 192.168.126.126 dev eth0
ip route append default nexthop via 172.21.107.113 dev eth0
ip route flush cache
chmod +x the file and add a call to it in your /etc/init.d/network file
You can specify only one GATEWAY, and if you added the GATEWAY in both interfaces files the GATEWAY of the higher interface number will be used as in your case eth1, which is correct from route -n you have displayed.
If you want to use multiple GATEWAYS you have to use policy routing as suggested in the previous answer.