Created
April 11, 2012 19:40
-
-
Save pdeschen/2361809 to your computer and use it in GitHub Desktop.
Set random hostname and register dhcp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set a random unique hostname to limit name collision | |
hostname=$(uuidgen | md5sum );hostname=${hostname:0:8}; | |
hostname=nc-${hostname} | |
hostname $hostname | |
sed -i s/^HOSTNAME=.*$/HOSTNAME=${hostname}/g /etc/sysconfig/network | |
sed -i s/^DHCP_HOSTNAME=.*$/DHCP_HOSTNAME=${hostname}/g /etc/sysconfig/network-scripts/ifcfg-eth0 | |
#with=" supersede host-name \"${hostname}\";" | |
#echo $with | |
#sed -i 's/^.*supersede\\shost-name.*$/${with}/g' /etc/dhclient.conf | |
/etc/init.d/network restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment