I have put a script in the downloads section that generates a host file from DNS. This is very useful where a group of systems are clustered and it is undesirable for a DNS issue to cause name service problems. Such as is the case with most clustering/ha solutions including VMware ESX, Symantec/Veritas VCS, SunCluster, TrueCluster, and most Linux based clustering software.
The output is sent to stdout and can be redirected to a file.
Options:
-d, –dnsdomain Set the DNS domain to use
-b, –basename Set the base of the server (hostname without the node number at the end)
-s, –static Add static address line, format: ipaddr hostname.domain hostname
-h, –help Print this useful help screen
Examples:
makeclusterhost.py > /etc/hosts –dnsdomain foo.com –basename server –static “192.168.10.3 virtualcenter.foo.com virtualcenter” –static “192.168.10.4 otherhost”
The /etc/host file contains the following:
# This file generated by makeclusterhost.py
# Do not edit, changes will be overwritten
127.0.0.1 localhost.foo.com localhost
#Static IP addresses (from command line)
192.168.10.3 virtualcenter.foo.com virtualcenter
192.168.10.4 otherhost
# Cluster IP addresses found in DNS
192.168.10.11 server01.foo.com server01
192.168.0.12 server02.foo.com server02
The script can be downloaded here