RE: per host ip info, without editing ks.cfg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What I like to do is configure a "static" address in dhcpd.conf tied to the
machines MAC then configure ks.cfg for just PLAIN dhcp. In the %post I run a
script that mounts an NFS volume and retrieves per machine settings like IP,
DNS, HOSTNAME from a config file based on the IP. I then update the relevant
files with the new info.

-->Rob



-----Original Message-----
From: kickstart-list-admin@xxxxxxxxxx
[mailto:kickstart-list-admin@xxxxxxxxxx]On Behalf Of Ed Brown
Sent: Monday, January 06, 2003 4:45 PM
To: kickstart-list@xxxxxxxxxx
Subject: per host ip info, without editing ks.cfg


	The question of how to kickstart everything but static ip configuration
has been asked several times, and the answer has usually been that you
can't.  Here's a method that seems to be working for my situation
anyway: redhat 7.3, ks=floppy, and --url ftp://...

In ks.cfg, use:
network --device eth0 --bootproto query

This will bring up the 1st phase (loader) networking configuration
screen and allow you to enter static ip info.  When anaconda starts up
however, it doesn't remember the info just entered, and doesn't
recognize "query" as a valid option (not that you'd want to enter it
twice anyway).

	By including the following %pre section, the ip info (including
hostname, which is derived from dns) is extracted from /tmp/netinfo,
(and /etc/resolv.conf) and replaces the network configuration line in
/tmp/ks.cfg, the local copy of the kickstart file, in time for it to be
parsed by anaconda.  No editing of ks.cfg on the floppy is required,
it's unchanged and ready for the next install.

---------------------------------
%pre

get()  {
        grep $1 /tmp/netinfo |cut -d'=' -f2
}

device=`get DEVICE`
ip=`get IPADDR`
netmask=`get NETMASK`
host=`get HOSTNAME`
gateway=`get GATEWAY`
nameserver=`grep  nameserver /etc/resolv.conf`

line="network --bootproto static --device $device --ip $ip --netmask
$netmask --hostname $host --gateway $gateway --$nameserver"

ks="/tmp/ks.cfg"
sed -e "/^network/s/^network.*/$line/" $ks >${ks}.tmp && mv ${ks}.tmp
$ks
-----------------------------------
(no line breaks, of course, in 'line="network...', or that last line,
'sed -e...')


-Ed



_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/kickstart-list





[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux