Changing hostname and IP Address on Solaris 10
1. Edit /etc/inet/hosts
127.0.0.1 localhost
192.168.100.2 newhostname loghost yourdomain.com
< >
2. Edit /etc/inet/ipnodes
newhostname
3. Edit /etc/nodenae
newhostname
4. Edit /etc/hostname.
newhostname
or
NewIP
5. Configure Name services ( Optional ). This case: configure to DNS client
5.1 Edit /etc/resolv.conf
search yourdomain.com
nameserver DNS-Server IP address
nameserver DNS-server IP address
5.2 Edit /etc/nsswitch.conf
Modify hosts: files to
hosts: files dns
==============================================
Changing IP Address, Hostname and DNS client with Scripts
#################################################
# Free Script for Change hostname, IP address and DNS client
# chhostip) by wihok
#!/usr/bin/ksh
read host?"Enter hostname : "
read ip?"Enter IP Address : "
read dns?"Enter DNS server IP [ 192.168.1.253 ] : "
read dnsdom?"Enter DNS Domain [ yourdomain.com ] : "
dns=${dns:="192.168.1.253"}
dnsdom=${dnsdom:="yourdomain.com"}
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}
# Make backup files
cp /etc/nodename /etc/org_nodename
cp /etc/hostname.$if /etc/org_hostname.$if
cp /etc/inet/hosts /etc/org_hosts
cp /etc/inet/ipnodes /etc/org_ipnodes
cp /etc/resolv.conf /etc/org_resolv.conf
cp /etc/nsswitch.conf /etc/org_nsswitch.conf
echo "$host" > /etc/nodename
echo "$host" > /etc/hostname.$if
cat > /etc/inet/hosts <
$ip $host loghost $dnsdom
EOT
cat > /etc/inet/ipnodes <
127.0.0.1 localhost
$ip $host loghost
EOT
cat > /etc/resolv.conf <
nameserver $dns
EOT
#Uncomment line below for use Dynamic route
#Comment line below for user Static route
#rm /etc/defautrouter 2>&-
uname -S $host
ifconfig $if $ip/24 broadcast + up
read reboot?"Reboot now ..... [ yes ] : "
case $reboot in
nN[Nn][Oo])
pkill Xsession 2> /dev/null
rm -r /.dt /.dtprofile
;;
*)
reboot
esac
#################################################
Friday, December 14, 2007
Changing IP Address and Hostname
Posted by wihok at 3:42 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment