I frequently build centos7 servers and have a few special networking requirements.
For example, I may want to use nameservers or repositories in private ranges that can't be reached via my normal subnet or default gateway.
Imagine a kickstart with something like the following:
network --device eth0 --bootproto static --ip 192.168.0.100 --netmask 255.255.0.0 --gateway 192.168.0.1 --nameserver 10.0.0.100
repo --name="private" --baseurl=http://172.16.0.100/private/7/x86_64
It's a purely theoretical setup.
The theoretical box has an ip address in 192.168 range, with a default gateway that can reach the wider world, but would like to reach the 10/8 network and 172.16/12
Additionally, imagine that the default gateway cannot reach these other subnets.
On a live centos environment I could do the following
ip route add 10.0.0.0/8 via 192.168.0.2
ip route add 172.16.0.0/12 via 192.168.0.3
and to make persistent, this could be added to /etc/sysconfig/network-scripts/route-eth0
How do I get all this to come into play in anaconda? Historically this may have worked in %pre, but if I ssh into anaconda while it is running I can see that these routes are not in place.
Best Answer
Why don't you just set up the static routes in
%post
?If you need the static routes during installation, you can certainly add the appropriate
ip route
commands to%pre
as well.