# From: Lisa Dong [mailto:lisad@scripps.edu] # Sent: Tuesday, February 15, 2005 10:22 AM # To: mfeilner@feilner-it.net # Cc: suse-autoinstall@suse.com # Subject: Re: [suse-autoinstall] dynamically assign hostnames? # # # Hi Markus, # # You can try to put the host name and IP in /etc/hosts file in # autoyast # post script. # # Lisa # # Markus Feilner wrote: # # >Hello List, # >I asked this before, but am still searching... is there a # way to avoid # >the autoinstall client naming himself "linux" ? # >If you install several boxes at the same time, the dhcp/dns # might get a # >little confused... # >;-) # >I was wondering if it's possible to name the autoinstallclient # >dynamically, with the mac-adress part of its name... any idea? I used the following - it's working well on 9.2 (obviously, you will need to change some of the name to suit your site): <post-scripts config:type="list"> <script> <filename>fix-hostname.sh</filename> <interpreter>shell</interpreter> <source><![CDATA[ #!/bin/bash suffix=$(hexdump -n 4 -e '"%x"' /dev/urandom) echo toolsgrp-$suffix.corp.mxtr.net >/etc/HOSTNAME cat >/etc/hosts <<@@@@End-Of-Hosts-File@@@@ # # hosts This file describes a number of hostname-to-address # mappings for the TCP/IP subsystem. It is mostly # used at boot time, when no name servers are running. # On small systems, this file can be used instead of a # "named" name server. # Syntax: # # IP-Address Full-Qualified-Hostname Short-Hostname # 127.0.0.1 localhost # special IPv6 addresses ::1 localhost ipv6-localhost ipv6-loopback fe00::0 ipv6-localnet ff00::0 ipv6-mcastprefix ff02::1 ipv6-allnodes ff02::2 ipv6-allrouters ff02::3 ipv6-allhosts 127.0.0.2 toolsgrp-$suffix.corp.mxtr.net toolsgrp-$suffix @@@@End-Of-Hosts-File@@@@ ]]> </source> </script> </post-scripts>