Tuesday, March 5, 2013

IP alias on CentOS6:"SIOCADDRT: No such process"

I just added an ip alias in my CentOS box by creating ifcfg-eth0:0 file with following content:
DEVICE=eth0:0
IPADDR=192.168.111.77
NETMASK=255.255.255.0
NETWORK=192.168.111.0
ONBOOT=yes
But after restarting network service I got following output:
Shutting down interface eth0:                [ OK ]
Shutting down loopback interface:            [ OK ]
Bringing up loobback interface:              [ OK ]
Bringing up interface eth0:  SIOCADDRT: No such process
                                             [ OK ]
The root cause is that the ifup procedure would like to add the default route to this alias, but the gatewa address is missing.
To get rid of this mistic message just give the gateway address to config by addiing following line in the alias interface config file:
GATEWAY="192.168.111.254"
Or of you do not need/have default gateway simply add:
GATEWAY=""
If you have a lot of aliases on a parent interface then you can add following line in parent interface config (ifcfg-eth0 in my case)
NO_ALIASROUTING=yes
After that the network restarted without the strange message.
Hope this helps somebody.