Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the CentOS 6 netinstall ISO with some kickstart files on an http server. When the ISO boots I hit TAB and enter the boot options asknetwork ks=http://<ip-address>/path/to/kickstart.ks.

My kickstart files do not have a network parameter, so it should be prompting. When I leave out asknetwork it tries to use DHCP. With asknetwork it only prompts for IP information.

Unfortunately anaconda is hell bent on automatically discovering the hostname, which ends up being a reverse DNS lookup of the IP, or localhost.localdomain if nothing was found.

Is there a way to make anaconda prompt for the hostname, or some way to pre-enter it through a custom boot option?

There used to be network --bootproto=query for CentOS 5, but this no longer works in 6.

share|improve this question
There used to be network --bootproto=query for CentOS 5, but this no longer works in 6. It is still there, and it works (I used it a few weeks ago). The trick seems to be that if the Kernel passes on any network information to Anaconda, then --bootproto-query will silently be ignored. – Stefan Lasiewski Jan 28 '13 at 23:00

I set the hostname in the kickstart file directly.

If you're trying to reuse the same template, you could get creative and use a bit of PHP to pass something to the installer. Kickstart files are http, so you could do something like:


...where kitty is a variable in the kickstart file that populates the --hostname= parameter

Or the better route is to use a more robust provisioning framework like Cobbler.

share|improve this answer
You naughty man! :-) – Andrew Smith Oct 23 '12 at 19:29
Why not simply pass "myname=kitty" and parse /proc/cmdline in the %post-section of kickstart? – Nils Oct 24 '12 at 19:46
I was thinking of PHP in the context of a larger solution. I prefer Cobbler, regardless. – ewwhite Oct 24 '12 at 20:02

I was trying to do this with virt-install and found a blog article with an excellent solution to this. The solution uses the /proc/cmdlines passed to the kernel at boot time to extract a hostname using a pre kickstart section and write a temporary file that is then included in the main kickstart section.

The blog was for kickstarting VMs in KVM. But I don't see any reason this wouldn't work in any other kickstart scenario where you can pass the kernel boot arguments easily.

share|improve this answer

I prefer this method using bash:

%include /tmp/network.txt

exec < /dev/tty3 > /dev/tty3 2>&1
chvt 3

while [ "$hn" == "" ]; do
 echo " *** Please enter the following details: *** "
 read -p "Hostname: " hn
chvt 1
echo "network --device eth0 --bootproto static --noipv6 --hostname ${hn}" > /tmp/network.txt
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.