#!/usr/bin/ksh ########################################################################## ## Change Hostname and IP address ## ## By UDOMSAK NAKSENA ( udomsak.n@g-able.com ) ## ########################################################################## read host?"Enter hostname : " read ip?"Enter IP Address : " read dns?"Enter DNS server IP [ 192.168.1.253 ] : " read dnsdom?"Enter DNS Domain [ mydomain.com ] : " dns=${dns:="192.168.1.253"} dnsdom=${dnsdom:="mydomain"} nic=`/usr/sbin/ifconfig -a | grep -v lo0 | grep ":" | head -1 | cut -d: -f1` read if?"Enter Network Interface Card name or just Enter for default ==> [ $nic ] : " if=${if:=$nic} echo "$host" > /etc/nodename echo "$host" > /etc/hostname.$if cat > /etc/inet/hosts < /etc/inet/ipnodes < /etc/resolv.conf < /dev/null ;; *) reboot esac ############################################################################## ### This script is submitted to BigAdmin by a user of the BigAdmin community. ### Sun Microsystems, Inc. is not responsible for the ### contents or the code enclosed. ### ### ### Copyright Sun Microsystems, Inc. ALL RIGHTS RESERVED ### Use of this software is authorized pursuant to the ### terms of the license found at ### http://www.sun.com/bigadmin/common/berkeley_license.jsp ##############################################################################