I'm running CentOS 6.2 on ESXi 5. The machine has 2 NICs, eth0 is connected to the Internet and eth1 to a LAN. eth0 has a single colo provided IP address, so the netmask is 255.255.255.255. The gateway is of course on a different subnet. After boot I've no Internet access, I'm solving it by running:
route add -host x.x.x.x dev eth0 route add default dev eth0 gw x.x.x.x
I want this to be automatic. Currently I've added these lines to the rc.local script. I've tried the recommended path of adding a route-eth0 script, but it doesn't work. I don't know what is correct syntax representing the route commands, nor how to see the errors my attempts generate. Can this be done via route-eth0 or some other expected CentOS way?
DEVICE="eth0" NM_CONTROLLED="yes" ONBOOT=yes HWADDR=xxx TYPE=Ethernet BOOTPROTO=none IPADDR=82.166.38.XX PREFIX=32 GATEWAY=82.166.190.YYY DNS1=xxx DOMAIN=xxx DEFROUTE=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no
Aseq's second scenario is very close, but the actual IP assignment is more complex. I got 82.166.38.XX, 82.166.38.XX+2 but they are reachable only through the 82.166.190.YYY, so if I put non 255.255.255.255 netmask those machine cannot communicate.
I think if I could translate the route syntax to ip addr syntax, it should work.