Los Angeles1
asked on
Linux, /etc/hosts question
I have a machine with the following first two lines
If I take out the xxclnt12 at the end of each line, will there be a problem aftter the next
?
127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 localhost xxclnt12x
::1 localhost.localdomain localhost.localdomain localhost6 localhost6.localdomain6 localhost xxclnt12x
If I take out the xxclnt12 at the end of each line, will there be a problem aftter the next
service network restart
?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, don't do that. xxclnt12x is the name of your computer. Those entries help some software that runs on your computer to "find" itself.
@ThomasMcA2: nope, an app/service should never find itself based on loopback address. It should use /etc/hostname and/or /etc/hostname.<interface>. (edit: location varies based on *nix flavour)
Some services use a specific name, e.g. some *nix systems use "loghost" to identify the target of syslog. But even then, "loghost" should be alias to the primary ethernet address and not the localhost.
The long and the short of it: woolmilkporc is right, with one addition: if this is the machine's name then it should appear with its primary IP in a separate line, e.g.:
unless of course the machine uses dynamic dhcp in which case you cannot (and should not) specify the hostname like that. Instead, you specify your hostname and primary interface in some config file and configure your DHCP client to request address for that particular interface. E.g. centOS uses /etc/sysconfig/network to specify hostname and /etc/sysconfig/network-scr ipts/ifcfg -eth0 to specify dhcp request for eth0 interface.
Some services use a specific name, e.g. some *nix systems use "loghost" to identify the target of syslog. But even then, "loghost" should be alias to the primary ethernet address and not the localhost.
The long and the short of it: woolmilkporc is right, with one addition: if this is the machine's name then it should appear with its primary IP in a separate line, e.g.:
192.168.22.44 xxclnt12x
unless of course the machine uses dynamic dhcp in which case you cannot (and should not) specify the hostname like that. Instead, you specify your hostname and primary interface in some config file and configure your DHCP client to request address for that particular interface. E.g. centOS uses /etc/sysconfig/network to specify hostname and /etc/sysconfig/network-scr