LinuxQuestions.org
Visit Jeremy's Blog.
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 07-23-2004, 06:43 AM   #1
gubak
Member
 
Registered: Jul 2004
Posts: 332

Rep: Reputation: 30
Fully qualified hostname


How can I ask for a fully qualified hostname or for a hostname?
 
Old 07-23-2004, 07:28 AM   #2
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
How can you ASK for one??? Well, the hostname is just the name of your computer. Just type "hostname" at the command prompt and you can see the computer's name. If you want to change it, try "man hostname" to see what options you can give the hostname command.

Some tutorials will ask for a fully qualified domain name (FQDN) which is the hostname plus a domain name. So "hostname.yourdomain.com" is a FQDN.
 
Old 07-23-2004, 07:43 AM   #3
calluminsky
Member
 
Registered: Jul 2004
Location: Milton Keynes, UK
Distribution: Red Hat Fedora
Posts: 35

Rep: Reputation: 15
Gubak

You may also need to put an entry in your /etc/hosts file too for your hostname. The format will resemble:

127.0.0.1 localhost.domainname.com
192.160.100.1 yourmachine.yourdomain.com yourmachine

The third entry on the second line is just an alias for ease of use.

Hope that helps.

Calluminsky
 
Old 07-23-2004, 08:07 AM   #4
0perat0r
Member
 
Registered: Jul 2004
Location: New Jersey, US
Distribution: Red Hat Linux WS version 3
Posts: 126

Rep: Reputation: 15
Editing etc/hosts does not work for me (I loose my connection to the Internet). I have not tried this yet, but a UNIX guru I work with told me to try altering /etc/sysconfig/network. Please proceed with caution, as always
 
Old 07-23-2004, 10:29 AM   #5
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
I'm not totally sure about this, but I believe /etc/sysconfig/network is only on RH and Fedora distros. I think other distros do it differently. But dont' quote me on that... I could be way off. And yes, you REALLY want to be careful in there because this is what your ethernet card uses when you restart the comptuer or restart your network. I DEFINITELY recommend saving a backup copy of this if you try to fiddle with it. Also google yourself silly on the contents of those files because the system is pretty picky about what goes in there and in what syntax. Basically this is like the permenent info stored on the computer that represents what you see when you run the ifconfig command.

You should be able to edit /etc/hosts without the internet being connected.

But then... aren't we getting way off topic here? I don't even know if we are helping the original poster with his question or not.
 
Old 07-23-2004, 12:40 PM   #6
0perat0r
Member
 
Registered: Jul 2004
Location: New Jersey, US
Distribution: Red Hat Linux WS version 3
Posts: 126

Rep: Reputation: 15
The question was somewhat vague to begin with (no offense intended to the orginal poster). Irregardless, you can find the same information in both /etc/hosts and /etc/sysconfig/network. I'm not sure how they differ or what the consequences of changing /etc/sysconfig/network are.
 
Old 07-23-2004, 02:00 PM   #7
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Well, as long as we're off topic anyway... what the hell!

/etc/hosts is where you define mappings between IP addresses and hostnames. So if you have another machine on your local network you can put the IP followed by the hostname so that the computer you're using knows what IP address needs to be queried whenever that hostname is used. It's like a mini DNS system.

On RH and Fedora, the file is /etc/sysconfig/network-scripts/ifcfg-eth0 where eth0 is the ethernet card's ID. This is just a regular file you can edit that has name/value pairs. You can edit these to change the properties of your ethernet card (in this case, eth0) and it will apply them when you do "service network restart" or reboot the machine. As I said before... be careful, make backups of this file, and try to be sure you know what you're doing when you change that stuff.
 
Old 07-23-2004, 07:18 PM   #8
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
Quote:
Originally posted by 0perat0r
Editing etc/hosts does not work for me (I loose my connection to the Internet). I have not tried this yet, but a UNIX guru I work with told me to try altering /etc/sysconfig/network. Please proceed with caution, as always
editing that file on RH9 works just fine. you need to be root, and you need to stay root to 'service network restart' as well.

FYI, thanks for the reminder, this was something i had forgotten about doing the last time i rebuilt my RH system.
 
Old 07-23-2004, 11:56 PM   #9
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
extra note:

when you edit your /etc/sysconfig/network file you will also need to add a line to your /etc/host file to match the new name you just gave your system. example:

this is the /etc/sysconfig/network

Code:
NETWORKING=yes
HOSTNAME=systemname.donaim
this is the /etc/hosts

Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1		localhost.localdomain localhost
127.0.0.1                   systemname.donaim

you want to keep the first line in the /etc/hosts alone, then just add the next line 127.0.0.1 ... and you should be set.

best of luck.

FYI, if you forget to add the line to the /etc/hosts file you will get an error when trying to log into gnome, and i can only guess into kde too, telling you it can not resolve the systemname.donaim and to add it to your /etc/hosts file and you will be set. just click the login anyways button to get past that error msg.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
squid FATAL: Could not determine fully qualified hostname. Please set 'visible_hostn tarakthakor Linux - Networking 5 12-04-2010 05:29 AM
hostname and fully qualified domain name setup help strimp099 Linux - Networking 7 01-14-2005 10:07 PM
sending with exim: need fully-qualified hostname otoomet Linux - Networking 1 01-06-2005 02:55 PM
squid fully qualified hostname DutchBoy Linux - Software 2 09-08-2004 10:17 PM
need fully qualified hostname before log-in - how? BrianK Linux - Networking 7 03-12-2002 06:21 PM

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

All times are GMT -5. The time now is 01:39 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