Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Hostname 4

Status
Not open for further replies.

moepower

Programmer
Oct 5, 2000
93
US
I have Solaris 8 running on a Sun Ultra 5 with hostname currently set to "Unknown" right now. How do I go about changing the hostname for this box?

Thanks,
 
what I do is 'sysunconfig' (i think that's it...or sysuncfg or something...or sys-unconfig). This will unconfigure just about everything in your system like you gave it a fresh install and you can rename your host. I'm sure there is an easier way to do it but I don't know what that is.

Mike
~~~~
simanek@uiuc.edu
"It's a Swingline!"
~~~~
 
Cheat ...
find in /etc/ a file called hostname.<interface>
for example, hostname.hme0 .... hostname.eri0 hostname.qfe1:1
(you get the idea)
edit the file, change it to be your desired name...

next, edit /etc/hosts and make sure that that name you placed in the hostname file is the first name listed for the interface's IP address... reboot... viola!

Hope that helps, it is how I have done it a number of times without problems...

-john
 
it can be more files ...,best way of altering a host's name, IP address, domain, timezone,etc., has always been &quot;/usr/sbin/sys-unconfig&quot;
This command asks for a new system's configuration consists of hostname, Network Information Service (NIS) domain name,LDAP, timezone,IP address, IP subnet mask, and root password. This command makes sure there are no applications running that get the configuration
changed while they are running (by shutting down the OS), and makes sure the configuration details are changed in all the right places, read man page of sys-unconfig(1M) before proceeding, also check that if there is a /etc/inet/ipnodes file exists and if there is IPv4 ip address entry in that file for new hostname, then that entry should be same as the one in /etc/hosts file.
Another method, which is not recommended by Sun is, changing hostname manually in files:/etc/nodename
/etc/inet/hosts
/etc/hostname.le0 or hostname.hme0 or an equivalent file
/etc/net/ticlts/hosts
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts
/etc/inet/ipnodes (if file exists and if hostname entry exists)
After modifying the above files, reboot the system.
Above two methods can change hostname of system. But for other operations depending on configuration, you may also have to change the information in /etc/inet/ipnodes, DNS files, NIS server entries, application files etc. having hostnames.

Hope This Helps,

Regards,

Carlos Almeida
 
Just one point, some systems might have valid reasons for having different hostnames on various nic's, so double check when changing /etc/hostname.hme0 etc..

i.e. You may have hostname1 on /etc/hostname.hme0 and hostname2 on /etc/hostname.qfe0




Ged Jones

Top man
 
After running the sys-unconfig, I no longer can ping any computers around me and Internet access is no longer working also. I set the hostname, IP Address, subnet while running sys-unconfig but did not select the name services. I went into /etc afterward and created an entry for the defaultrouter file.

Am I missing something else?

Thank You,
 
If you don't select any name service on sys-unconfig, you need to configure one for resolving ip address, i.e if you use DNS just edit /etc/resolv.conf and add

nameserver ipaddress-of-primary-dns
nameserver ipaddress-of-secondary-dns

then check /etc/nsswitch.conf you will need for the host line something like:
hosts: files dns

also /etc/defaultrouter only take efect after a &quot;reboot&quot;, if you don't want to reboot now add default route with:

route add default gateway

where gateway is you gateway hostname or ip adress, then you can check with netstat -rn and try ping your router/gateway.

Hope this helps,

Regards,

Carlos Almeida,
 
Just an addition to Carlos' last statement about rebooting for changes to take affect. You don't have to reboot (though you can).
After creating the /etc/defaultrouter file, try the following command...

# /etc/rc2.d/S69inet stop
# /etc/rc2.d/S69inet start

This enables router discovery, but with the /etc/defaultrouter present, it sets the default router to the entry within the defaultrouter file.

If you do a netstat -rn the default entry should show the IP address you are looking for.
I've done it this way many times without any problems.

Good Luck. Have a Great Day!! :)
~Sol
Sys Admin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top