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: dev eth0
default via 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= --netmask= --gateway= --nameserver= --ipv6=2001:db8:de10:4f95::51/64

Unfortunately, you can’t fully configure IPv6 (yet) from the installer or kickstart; you will need to make one change after installation. Edit the /etc/sysconfig/network-scripts/ifcfg-enp2s1 file and remove the IPV6_AUTOCONF=no line which was inserted by anaconda. Once you restart networking, (ifdown enp2s1; ifup enp2s1) IPv6 will then be functional using the route advertised by OVH’s on-link router(s).

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.