I'm running Red Hat 7.1 at work on my laptop and the IP address is assigned via DHCP. If I want to change my hostname from "localhost.localdomain" to whatever I please, how do I do it?
I don't know how much you know about networks, so forgive me if I'm telling you anything you already know. You'll always want to have references in your hostfile to "localhost" as this is pretty much the standard way of referencing the local machine, and not having a "localhost" reference in your /etc/hosts file will break some programs and scripts. Also, it helps to define what is ment by "localdomain". Whether or not your machine has a network interface device, like a modem, or ethernet card, there is always a built-in network device called the "loopback device" or "loopback interface". If you run ifconfig, you should see some data about that, in addition to any other network devices you may have. This loopback device isn't really a physical device, but rather a software construct that acts like a network device. It allows two network applications to communicate if they are running on the same machine. Your IP for this device is 127.0.0.1. This device also need a network address, And if memory serves, any packet sent to 127.x.x.x will be sent out the loopback interface (and also, recieved throught the loopback interface). 127.0.0.0 is the local domain. Here's what I have in my /etc/hosts file: -------- 127.0.0.1 tundra localhost tundra.abyss localhost.localdomain 192.168.42.2 savannah savannah.abyss --------- First, the background: This machine is on a home network with the domainname "abyss". There are 2 machines on this network: "tundra" and "savannah". The machine that I snagged this /etc/hosts file from is tundra. What the first line does is establish 4 names for this machine: localhost, tundra, tundra.abyss, and localhost.localdomain. The second line adds an entry for the other machine on the home network, savannah. There is also another file called /etc/networks, which defines the network names in the same way that /etc/hosts defined hosts names. Here's mine: ---------- localdomain 127.0.0.0 abyss 192.168.42.0 ---------- The first line established the network on loopback device (which only has one machine). the secons establishes the external network. As you can see, the local network (localdomain) is NOT the same as an external network. If you don't have your machine on a home lan, Finally, my machine now has 2 names tundra and localhost. my /etc/hostname file has to include my desired hostname. It contains only one line, which has the name I'd like to use for my machine. ----------- tundra ----------- Hope this helps.