PDA

View Full Version : The Hostname doesn't appear?


hermouche
2007-09-24, 09:55 PM CDT
Hy,

The Hosts box under "system-config-network" command is empty.

My prompt is [root@localhost ~]#

How to have the Hosts box full, i mean with IP, name and aliases?

Thanks,
red :)

ppesci
2007-09-24, 10:37 PM CDT
As root, edit the file /etc/hosts, 1 host per line.
Example:

127.0.0.1 localhost

HTH

hermouche
2007-09-24, 10:54 PM CDT
As root, edit the file /etc/hosts, 1 host per line.
Example:

127.0.0.1 localhost

HTH

Hy,

Thanks for the reply.

Yes i have it like this:

[root@localhost ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.





::1 localhost.localdomain localhost



[root@localhost ~]#

I think it's the same isn't it?

red

ppesci
2007-09-24, 11:07 PM CDT
Yes, is the same. In fact system-config-network display the content of this file. You can edit manually.

hermouche
2007-09-24, 11:12 PM CDT
Yes, is the same. In fact system-config-network display the content of this file. You can edit manually.

I can't edit , nothing appears when i select the edit buttom. I guess it's because there nothing to edit since it's blank !!!!

red

Wayne
2007-09-24, 11:15 PM CDT
Have you tried changing (in the second shot) 'locahost' to something else?

Edit: Actually, change it on the first tab (Devices) or you can get the hostname assigned via DHCP

Wayne

hermouche
2007-09-24, 11:18 PM CDT
Yes, is the same. In fact system-config-network display the content of this file. You can edit manually.

If i add a new line such as the following:

# Do not remove the following line, or various programs
# that require network functionality will fail.

::1 localhost.localdomain localhost
192.168.1.1 localhost.localdomain localhost

I got the attachement picture:


red

gthill
2007-09-25, 12:17 AM CDT
hermouche
To set up your hostname you need to edit 2 files
/etc/hosts
/etc/sysconfig/network

Here is my hosts file from my laptop as an example.
the first line 127.0.0.1 you will need to put back as that is for your loopback device, like an internal network interface that your machine requires for network functionality. As you can see I edited this line and added the hostname of my machine as the first listing, the others are aliases which are also valid and needed. (you can add as many aliases as you like)
The purpose of the other lines are simply for resolving the ip addresses by name.
the WAN line just speeds up my remote login
the LAN lines were for my network (which is now dead) but as you can see there is another hostname lap1, this is my eth0 address automatically assigned when my laptop was connected to my LAN. You can add a line like that if you have a fixed ipaddress. tc2 was my desktop and the others were old machines I had connected for fedorafolders.

The other file you need to edit is /etc/sysconfig/network. There is a place for your hostname there as well.



[gordon@lap1 ~]$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=lap1

[gordon@lap1 ~]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 lap1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

# DSL Modem
192.168.0.1 netgear

# gateway www interface
192.168.0.4 gateway # gateway eth0

# WAN IP addresses
203.36.217.231 gthill.servegame.org

# LAN IP addresses
192.168.1.1 tc4 # gateway lan interface eth1
192.168.1.2 tc2
192.168.1.3 tc3
192.168.1.5 tc5
192.168.1.6 tc6
192.168.1.7 tc7 lap1