i am having a situation where
route add
is not working but if i add that as a static entry in sysconfig/network-scripts/route-eth0
its working
Network details:
IPADDR=198.x.x.1
NETMASK=255.255.255.255
BROADCAST=198.x.x.1
if i add a static route using
route add default gw 192.x.x.254
it returns
SIOCADDRT: No such process
simillary
ping 192.x.x.254
connect: Network is unreachable
strangely if i add it as static entry in route-eth0
route add 192.x.x.254 dev eth0
route add default gw 192.x.x.254
everything works,i can see default gw in route -n
and ping is also working
So what is making the difference here?
Best Answer
You cannot add that route because that default gateway is in different subnet and thus is not reachable.
From man route: