Skip to content

Instantly share code, notes, and snippets.

@mihgen
Created May 18, 2011 12:09
Show Gist options
  • Select an option

  • Save mihgen/978459 to your computer and use it in GitHub Desktop.

Select an option

Save mihgen/978459 to your computer and use it in GitHub Desktop.
hostname_bind
# In our case mac-address is easiest way to static bind hostname to server.
HOSTNAME="pmo-cluster"
MAC=`ifconfig eth0 | grep HWaddr | cut -c 39-`
case "$MAC" in
'00:24:1D:CE:71:C1')
HOSTNAME="pmo-cluster1"
;;
'00:24:1D:DD:FC:97')
HOSTNAME="pmo-cluster4"
;;
esac
cat > /etc/sysconfig/network << EOF
NETWORKING=yes
HOSTNAME=$HOSTNAME
EOF
# hostname MUST provide network access to host, otherwise "rabbit" doesn't work.
echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment