Can route-eth0 be created via CentOS 7 Anaconda installer?

Steve Amerige asked:

I’m using the CentOS 7 Anaconda installer.

I want the file /etc/sysconfig/network-scripts/route-eth0 to be created, if possible, by this installer. The file route-eth0 should have the contents after installation such as:

11.22.33.44 dev eth0
default via 11.22.33.44 dev eth0

I’m doing this because my data center provider is OVH and they have the requirement that this file have this content. The IP address above is the gateway address of the KVM server on which I’m creating a VM via the CentOS installer.

Presently, I’m doing this as a post-provisioning activity. I’m hoping it can be done as part of the CentOS 7.2 installation. If not, can someone show how to do this as part of a kickstart file?

My answer:


You don’t need to do this. Just enter in the failover IP, netmask 32, and gateway address in the installer, and everything will work. The routes that used to go in route-eth0 are auto-generated by the kernel now.

To use it in a kickstart is the same way:

network --bootproto=static --ip=203.0.113.81 --netmask=255.255.255.255 --gateway=198.51.100.254 --nameserver=192.0.2.2 --ipv6=2001:db8:de10:4f95::51/64

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.