Hello all, I've been struggling with an issue with my kickstart configuration for a while now. My kickstart files are stored within the initrd image. What I would like to do here, is when the kickstart first starts up, I want it to grab a DHCP address (it does at the moment) so it can grab all of the necessary installation data off the net. Then, at some point _IN_ the install process, I'd like to have it query for manually input network settings. Here is my current kickstart script:
auth --useshadow --enablemd5 bootloader --location=mbr zerombr clearpart --all --initlabel text firewall --enabled --port=22:tcp firstboot --disable keyboard us lang en_US logging --level=info url --url=http://mirror.nexcess.net/CentOS/5.5/os/x86_64/ reboot --eject rootpw --iscrypted xx selinux --enforcing skipx timezone --isUtc America/Detroit install
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=512 --ondisk=sda part swap --bytes-per-inode=4096 --fstype="swap" --size=2048 --ondisk=sda part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1 --ondisk=sda part /backup --bytes-per-inode=4096 --fstype="ext3" --grow --size=1 --ondisk=sdb
network --bootproto=dhcp --device=eth0
%packages --nobase @core system-config-network-tui
%post echo "nameserver 4.2.2.1" > /etc/resolv.conf echo "nameserver 8.8.8.8" >> /etc/resolv.conf
# write netconfig script cat << EOF > /bin/netconfig #!/bin/bash # check if user is root if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi # run system-config-network-tui /usr/sbin/system-config-network-tui # set variables eth0f="/etc/sysconfig/network-scripts/ifcfg-eth0" eth1f="/etc/sysconfig/network-scripts/ifcfg-eth1" netcfg="/etc/sysconfig/network" # turn on eth1 if it has an address, remove gateway.. shouldn't be set here # anyways if [ -f "$eth1f" ]; then if grep -q "IPADDR" $eth1f; then sed -i 's/ONBOOT=no/ONBOOT=yes/' $eth1f sed -i '/^GATEWAY/d' $eth1f sed -i '/^HOTPLUG/d' $eth1f fi fi # move gateway from ifcfg-eth0 to /etc/sysconfig/network if [ -f "$eth0f" ]; then e0gw=$(grep "GATEWAY" $eth0f) sed -i '/^GATEWAY/d' $eth0f # check to see if the gateway is already set. if it is, delete it first if ! grep -q "GATEWAY" /etc/sysconfig/network; then echo $e0gw >> $netcfg else sed -i '/^GATEWAY/d' $netcfg echo $e0gw >> $netcfg fi fi EOF chmod +x /bin/netconfig
At the moment, I have a not-so-elegant script written to the server to be run manually after install. I began using system-config-network-tui vanilla, but realized it had some differences from the network configuration tool in anaconda (net.c?) I tried my best to correct those differences with my netconfig script. I've already tried running system-config-network-tui in the %post section, but it doesn't seem to work. If anyone has had experience in dealing with a scenario such as this, any help would be greatly appreciated.
Thanks, Daniel Theisen dtheisen@nexcess.net
On Tue, Dec 28, 2010 at 10:59 AM, Daniel Theisen dtheisen@nexcess.net wrote:
Hello all, I've been struggling with an issue with my kickstart configuration for a while now. My kickstart files are stored within the initrd image. What I would like to do here, is when the kickstart first starts up, I want it to grab a DHCP address (it does at the moment) so it can grab all of the necessary installation data off the net. Then, at some point _IN_ the install process, I'd like to have it query for manually input network settings. Here is my current kickstart script:
This is a common setup. My suggested approach is to always use DHCP, and set DHCP reservations on your DHCP server to consistently assign the same IP to the same client's MAC address. That way, you can assign the IP and hostname in your local DNS or /etc/hosts or NIS hosts table or whatever, and get it set consistently.
The only missing feature this way for CentOS 5 is the list of automatic search domains, for which the network setup tools provide no DHCP compatible hook and the DHCP is too old to follow the years-old RFC and handle multiple searchable domains. The answer to that is to manually put a "SEARCH" setting in /etc/sysconfig/network.
If you're going to be doing this a lot, set up a local CentOS mirror and take most of the load off the external servers. It's a lot of bandwidth to be eating all the time for rebuilds.
%post echo "nameserver 4.2.2.1" > /etc/resolv.conf echo "nameserver 8.8.8.8" >> /etc/resolv.conf
# write netconfig script cat << EOF > /bin/netconfig #!/bin/bash # check if user is root if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi # run system-config-network-tui /usr/sbin/system-config-network-tui
You can set up the eth0/eth1/etc. ports entirely from the output of "/sbin/ifconfig". If folks like, I'll try to dig up my tools.
The "system-config-network-tui" script is, sadly, pretty useless for auto-provisioning. None of RHEL's upstream tools have support for configuring pair bonding or network bridging correctly, which is pretty important for servers or KVM virtualization server setups.
This is a common setup. My suggested approach is to always use DHCP, and set DHCP reservations on your DHCP server to consistently assign the same IP to the same client's MAC address. That way, you can assign the IP and hostname in your local DNS or /etc/hosts or NIS hosts table or whatever, and get it set consistently.
This wouldn't be an issue if our network was built out with static DHCP in mind. We have over 1000 servers that already have manually assigned static IP addresses. The switch to static DHCP would be way too huge of an effort for a simple problem like this
If you're going to be doing this a lot, set up a local CentOS mirror and take most of the load off the external servers. It's a lot of bandwidth to be eating all the time for rebuilds.
This IS a local mirror.
You can set up the eth0/eth1/etc. ports entirely from the output of "/sbin/ifconfig". If folks like, I'll try to dig up my tools.
Could you, it might be helpful to me :)
Thanks, Daniel Theisen dtheisen@nexcess.net
On 12/28/10 1:41 PM, Daniel Theisen wrote:
This is a common setup. My suggested approach is to always use DHCP, and set DHCP reservations on your DHCP server to consistently assign the same IP to the same client's MAC address. That way, you can assign the IP and hostname in your local DNS or /etc/hosts or NIS hosts table or whatever, and get it set consistently.
This wouldn't be an issue if our network was built out with static DHCP in mind. We have over 1000 servers that already have manually assigned static IP addresses. The switch to static DHCP would be way too huge of an effort for a simple problem like this
You wouldn't have to change anything on already-assigned servers - just include the known mac/ip pairs in your dhcp setup so they will be correct when you reinstall next time.