how to setup a hostname in linux - need help
How to setup a hostname in linux RH 9.0? The reason I am trying to do this is right now I am accessing linux using its IPaddress. I want give a name to it and use the name to access linux from other machine. I don't know how to configure the host name. Could you please help me do it. Thanks.
|
go to the computer (the you use to connect to the computer you want to give a host name to)
then edit this file as root /etc/hosts simply add a new line with the ip address of the computer, then a space, then put a host name there |
Use the hostname command to set the hostname (run it from rc.local or set it in the network configuration to make it stick between boots). However, setting a hostname on one machine does not make it so that your other machines magically know about it. To do that, you must either set up DNS (probably overkill, unless you have a lot of hosts) or add it to the /etc/hosts file on all of the remote systems.
|
thanks SciYro,
I did adding ip address and a hostname on \etc\hosts file. But if I ping the host name from my laptop it doesn't respond. But if I ping same IP address from my laptop it responds. What should I do now? Thanks, Tej |
try this command
echo 192.168.0.1 newhost >> /etc/hosts as root, replace 192.168.0.1 with the ip of the computer to connect to, then ping newhost should work .. works for me without a hitch |
All times are GMT -5. The time now is 09:21 AM. |