Linux - NewbieThis 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!
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.
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.
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
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.
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.
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.
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.
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
this is the /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
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.