LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-07-2001, 06:23 PM   #1
iggymac
Member
 
Registered: Aug 2001
Posts: 77

Rep: Reputation: 15
how do you name your machine?


This is probably the stupidest question ever asked on a newsgroup about Linux, but here goes:

How do I "name" my machine?

Every time I am doing something network related I read about using the servername or machine name or IP.

Since I use a router and my IP changes with DHCP every time and I am not running a DNS server how can I assign a name to this machine?

The only entry I have in /etc/hosts is

127.0.0.1 localhost.localdomain localhost

Am I just not understanding the basics here?

Could someone point me in the right direction?

Thanks
 
Old 11-07-2001, 07:39 PM   #2
taz.devil
Senior Member
 
Registered: Nov 2001
Location: Wa. State
Distribution: Slackware
Posts: 1,261

Rep: Reputation: 45
You can name it whatever you want or need it to be for a server etc...Just do a netconfig or edit the HOSTNAME, NETWORKING and hosts files and change it to what you need...
 
Old 11-07-2001, 10:50 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
easiest way to just name your machine without editing by hand and from the command line would be this:

# hostname name-you-want
 
Old 11-08-2001, 01:41 PM   #4
iggymac
Member
 
Registered: Aug 2001
Posts: 77

Original Poster
Rep: Reputation: 15
Sorry.

I still don't get it.

If I do:

hostname xxxxx

I then cannot ping that name, even from the same system.

And in my past experience, if I alter the hosts file to anything other than the default:

127.0.0.1 localhost.localdomain localhost

I get an error about no localhost listing on boot.

Are we talking about just adding an alias to the hosts file? Is that what the hostname command is supposed to do?
 
Old 11-08-2001, 03:11 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
although the name of the machine is usually the same as it's network name, it's not law, so isn't inter-related

in order to be able to ping the name you need to add the entry to /etc/hosts, but that's for a network, which is where the difference comes in, you only need to ping your own machine if you're on a network, so you don;t need to worry about that if you're only on a standalone box. 127.0.0.1 is always localhost, as that's an internal, pretend network, but i guess you might get away with adding the host name after it, not really that useful tho, as far as i can see.

ok, so reading your post again i get a little bit the wrong end of the stick.. but i hope some of that is useful. the hostname is network based, nothing to do with 127.0.0.1
 
Old 11-08-2001, 03:14 PM   #6
taz.devil
Senior Member
 
Registered: Nov 2001
Location: Wa. State
Distribution: Slackware
Posts: 1,261

Rep: Reputation: 45
Well, it's easier if you can do a netconfig and it'll prompt for answers, but not ever distro has it. It depends on what you are wanting to do. I assume in KDE the network config could work just as well. Your dynamic connection shouldn't matter if you are only configuring the "cosmetic" name for your machine. The 127.0.0.1 is in ever distros files. That IP allows the box to work as a loopback device so that you don't have to have a network. I guess i'm confused as to what exactly you want it used for? Let us know...Now i'm conflustered.. LOL
 
Old 11-09-2001, 06:27 PM   #7
iggymac
Member
 
Registered: Aug 2001
Posts: 77

Original Poster
Rep: Reputation: 15
Hmmm. Still confused myself

Using the command hostname, what do you use that name for?

You can just add an extra entry to /etc/hosts with your IPand name you want can't you?

But then if you have another machine you want to connect to it with and you want to use your machine name instead of IP don't you have to have a hosts file on the new machine with the name of the first machine in it?

And you can't do this with DHCP assigned addresses can you?

Basically the ultimate goal is just so that I can ssh or ftp to servername and not IP. I guess that's my long term goal here.

Am I making sense at this point?

Thanks.
 
Old 11-12-2001, 12:29 AM   #8
iggymac
Member
 
Registered: Aug 2001
Posts: 77

Original Poster
Rep: Reputation: 15
Ok. I think I have figured it out somewhat.

If I use a static IP address on this machine and put an extra entry into /etc/hosts like:

myipaddress myhostname alias

then it works and I can ping that name and alias.

BUT

1. The hostname command will change the hostname only temporarily. Upon reboot it will revert to whatever is in the /etc/hosts file. So I still don't know why you would use the command hostname.

2. What do you do if you have a DHCP assigned address instead of a static one?

Thanks.
 
Old 11-12-2001, 03:27 AM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
try editing /etc/sysconfig/network
 
Old 11-13-2001, 07:58 PM   #10
SlCKB0Y
Member
 
Registered: Oct 2001
Location: Sydney
Distribution: Arch
Posts: 295

Rep: Reputation: 96
Quote:
Originally posted by acid_kewpie
although the name of the machine is usually the same as it's network name, it's not law, so isn't inter-related



in order to be able to ping the name you need to add the entry to /etc/hosts, but that's for a network, which is where the difference comes in, you only need to ping your own machine if you're on a network, so you don;t need to worry about that if you're only on a standalone box. 127.0.0.1 is always localhost, as that's an internal, pretend network, but i guess you might get away with adding the host name after it, not really that useful tho, as far as i can see.



ok, so reading your post again i get a little bit the wrong end of the stick.. but i hope some of that is useful. the hostname is network based, nothing to do with 127.0.0.1
The actualy hostname of a machine is configured by the /etc/HOSTNAME file. what the /etc/hosts file basically is a precursor to DNS. You can read up on the details by doing a man hosts and man hostname

as someone said before, the easiest thing to try is a
# hostname thenameyouwanthere

but i have had systems where that hasnt worked. if you have a mainstream distro, there are almost always GUI tools to configure this. even slackware has a GUI for it (a rarity in slackware). netconf, netconfig are things you might be trying.

Failing that, try linuxconf on redhat or yast2 on suse
 
Old 11-13-2001, 10:27 PM   #11
iggymac
Member
 
Registered: Aug 2001
Posts: 77

Original Poster
Rep: Reputation: 15
Thanks to all for the answers.

I think I understand it now.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 12:23 PM
trying to copy files from another machine to the local machine using telnet,..how? shrike_912 Programming 6 03-14-2006 04:45 PM
sharing internet from a windows 98 machine to a Red Hat Linux machine ritwiksolutions Linux - Newbie 7 03-14-2006 10:20 AM
how to open a dilog on local machine when i do ssh to remote machine fahad26 Programming 3 05-03-2005 07:39 PM
Display of Unix Machine on a PCQ Linux Machine gopalkasat Linux - Networking 1 12-14-2004 02:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration