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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-23-2004, 06:43 AM
|
#1
|
Member
Registered: Jul 2004
Posts: 332
Rep:
|
Fully qualified hostname
How can I ask for a fully qualified hostname or for a hostname?
|
|
|
07-23-2004, 07:28 AM
|
#2
|
Member
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736
Rep:
|
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.
|
|
|
07-23-2004, 07:43 AM
|
#3
|
Member
Registered: Jul 2004
Location: Milton Keynes, UK
Distribution: Red Hat Fedora
Posts: 35
Rep:
|
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
|
|
|
07-23-2004, 08:07 AM
|
#4
|
Member
Registered: Jul 2004
Location: New Jersey, US
Distribution: Red Hat Linux WS version 3
Posts: 126
Rep:
|
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
|
|
|
07-23-2004, 10:29 AM
|
#5
|
Member
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736
Rep:
|
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.
|
|
|
07-23-2004, 12:40 PM
|
#6
|
Member
Registered: Jul 2004
Location: New Jersey, US
Distribution: Red Hat Linux WS version 3
Posts: 126
Rep:
|
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.
|
|
|
07-23-2004, 02:00 PM
|
#7
|
Member
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736
Rep:
|
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.
|
|
|
07-23-2004, 07:18 PM
|
#8
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Rep:
|
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.
|
|
|
07-23-2004, 11:56 PM
|
#9
|
Senior Member
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 01:39 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|