RHEL5/CentOS5 KS Network Oddities (ifcfg-* gets re-written)
Daniel Segall
dan at half-asleep.com
Wed Sep 26 17:02:03 UTC 2007
Steve Robson wrote:
>> Subject: RHEL5/CentOS5 KS Network Oddities (ifcfg-* gets re-written)
>> From: "kslist" <kslist at devo.com>
>> Date: Wed, 26 Sep 2007 01:02:53 +0200 (CEST)
>> To: kickstart-list at redhat.com
>>
>> Hello KSers,
>>
>> I am using my Kickstart script that I have adapted from RHEL 2.1, 3,
>> and 4
>> now on CentOS 5. CentOS 5 behaves differently when it comes to network
>> configuration.
>>
>> In essence: AFTER the successfull installation, during the first startup
>> of the OS, something desctroys my network configuration. Specifically,
>> the
>> files that I have directly written in my %post script:
>> /etc/sysconfig/network
>> /etc/sysconfig/network-scripts/ifcfg-eth0
>> /etc/sysconfig/network-scripts/ifcfg-eth1
>> /etc/hosts
>> /etc/resolve.conf
>> are modified, and in the case of the ifcfg-* scripts, my scripts are
>> moved
>> to a *.bak file (which have a datestamp later than the files I created
>> via
>> %post, and which correspond to the firstboot) and a completely newfile is
>> created in its place.
>>
>> The network configuration that replaces my own is one for DHCP.
>>
>> My guess is that this is a result of a change in behaviour of the
>> "network" option. To quote from the RHEL 5 Installation Guide:
>>
>> "Configures network information for the system. If the kickstart
>> installation does not require networking (in other words, it is not
>> installed over NFS, HTTP, or FTP), networking is not configured for the
>> system. If the installation does require networking and network
>> information is not provided in the kickstart file, the installation
>> program assumes that the installation should be done over eth0 via a
>> dynamic IP address (BOOTP/DHCP), and configures the final, installed
>> system to determine its IP address dynamically. The network option
>> configures networking information for kickstart installations via a
>> network as well as for the installed system."
>>
>> Now, I see a problem here:
>> - I use DHCP to install the system (via Kickstart)
>> - I however do NOT want to run the subsequently installed OS to use DHCP.
>>
>> I would say that is a very very normal thing to want.
>
> Completely normal, I do it all the time!
>
> Typically I use one of the following "network" directives, depending how
> I want the resulting client to behave. Beware that if you choose to
> statically address the target client using this method, its IP address
> must be on the same subnet as your KS server.
>
> network --device=eth0 --bootproto=dhcp --hostname=lnx-blah
> or
> network --bootproto static --device=eth0 --gateway=I.P.of.GW
> --ip=I.P.of.client --nameserver=IP.of.DNS.server
> --netmask=I.P.of.netmask --onboot=on --hostname=lnx-blah
>
> Hope this helps, see here for full detail:
> http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-options.html
>
>
I think what the OP is referring to is network config files that were
changed in %post being squashed after reboot. I noticed this as well
when I first started building my configs for RHEL5, but since we haven't
been using them, I never looked into it.
So for example, you use DHCP during the install, then set the IP's in
the %post. When the server reboots, it seems to overwrite any changes
you made to the /etc/sysconfig/network-scripts/ifcfg-* files.
Hope that helps clarify.
-Dan
More information about the Kickstart-list
mailing list